Skip to content

Commit

Permalink
Merge pull request #135 from mjsoftking/perf-number-error
Browse files Browse the repository at this point in the history
perf(widget):优化分类、标签、标签云下文章数量显示异常
  • Loading branch information
nineya authored May 23, 2024
2 parents eb430d0 + e34a88c commit f781a3e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions templates/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<li th:each="category : ${categories}">
<a class="level is-marginless" th:href="${category.status.permalink}">
<span class="level-item" th:text="${category.spec.displayName}"></span>
<span class="level-item tag" th:text="${category.status.postCount}"></span>
<span class="level-item tag" th:text="${category.status.postCount == null ? 0 : category.status.postCount}"></span>
</a>
<ul th:if="${!#lists.isEmpty(category.children)}">
<th:block th:replace="~{:: categories (${category.children})}"/>
</ul>
</li>
</th:block>
</th:block>
</th:block>
4 changes: 2 additions & 2 deletions templates/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<a th:each="tag : ${tags}" class="tags" th:href="${tag.status.permalink}">
<span class="tag" th:text="${tag.spec.displayName}"
th:style="${(enableTagsColor && tag.spec.color != '#ffffff')? 'color: ' + tag.spec.color +'; background: ' + tag.spec.color +'20' : ''}"></span>
<span class="tag is-grey" th:text="${tag.postCount}"
<span class="tag is-grey" th:text="${tag.postCount != null ? tag.postCount : 0}"
th:style="${(enableTagsColor && tag.spec.color != '#ffffff')? 'background: ' + tag.spec.color +'CC' : ''}"></span>
</a>
</div>
</div>
</th:block>
</th:block>
</th:block>
</th:block>
4 changes: 2 additions & 2 deletions templates/widget/categories.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div xmlns:th="https://www.thymeleaf.org"
th:fragment="widget (sidebar)"
th:class="'card widget ' + ${sidebar.hide}">
th:class="'card widget ' + ${sidebar.hide}"
th:with="num = ${#strings.isEmpty(theme.config.sidebar.categories_num)? 10 : T(java.lang.Integer).parseInt(theme.config.sidebar.categories_num)},
categories = ${categoryFinder.list(1,num)},
isEmpty = ${#lists.isEmpty(categories)}">
Expand All @@ -20,4 +20,4 @@
</li>
</ul>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions templates/widget/tagcloud.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
th:each="tag : ${tags}"
th:href="@{${tag.status.permalink}}"
th:text="${tag.spec.displayName}"
th:with="size = ${#strings.length(tag.spec.displayName) + #strings.length(tag.spec.slug) + tag.postCount}"
th:with="size = ${#strings.length(tag.spec.displayName) + #strings.length(tag.spec.slug) + (tag.postCount != null ? tag.postCount : 0)}"
th:style="'font-size: ' + ${size < 14 ? 14 : size > 32 ? 32 : size} + 'px;' + ${(enableTagsColor && tag.spec.color != '#ffffff')? 'color: ' + tag.spec.color +';' : ''}"></a>
</div>
</div>
</div>

0 comments on commit f781a3e

Please sign in to comment.