Skip to content

Commit

Permalink
优化编辑文章按钮权限控制
Browse files Browse the repository at this point in the history
解决标签栏显示空白
  • Loading branch information
chengzhongxue committed Oct 16, 2024
1 parent 4536831 commit a5a1597
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
3 changes: 1 addition & 2 deletions templates/modules/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@
</th:block>
<span class="sidebar-menu-item-title">标签</span>
<div class="card-widget card-tags card-archives card-webinfo card-allinfo"
th:with="tags = ${tagFinder.listAll()}, tagQuantity = ${#conversions.convert(theme.config.sidebar.tagQuantity, 'java.lang.Integer')}">
th:with="tags = ${tagFinder.list(1,theme.config.sidebar.tagQuantity)}">
<div class="item-headline"></div>
<div class="card-tag-cloud">
<a class="tag-item" style="font-size:1em" th:each="tag,iterStat : ${tags}"
th:href="@{${tag.status.permalink}}"
th:if="${tagQuantity >= 0 && iterStat.index < tagQuantity || tagQuantity < 0}"
th:title="${tag.spec.displayName}">
<!-- 角标 -->
[[${tag.spec.displayName}]]<sup th:text="${tag.status.visiblePostCount}"></sup>
Expand Down
3 changes: 1 addition & 2 deletions templates/modules/widgets/aside/contain/tags-contain.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<!-- 标签 -->
<th:block
th:with="tags = ${tagFinder.listAll()}, tagQuantity = ${#conversions.convert(theme.config.sidebar.tagQuantity, 'java.lang.Integer')}">
th:with="tags = ${tagFinder.list(1,theme.config.sidebar.tagQuantity)}">

<div class="item-headline"></div>
<div class="card-tag-cloud">
<a class="tag-item" style="font-size:1em" th:each="tag,iterStat : ${tags}"
th:href="@{${tag.status.permalink}}"
th:if="${tagQuantity >= 0 && iterStat.index < tagQuantity || tagQuantity < 0}"
th:title="${tag.spec.displayName}">
<!-- 角标 -->
[[${tag.spec.displayName}]]<sup th:text="${tag.status.visiblePostCount}"></sup>
Expand Down
2 changes: 1 addition & 1 deletion templates/modules/widgets/aside/recent-posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="item-headline"><i class="haofont hao-icon-eicon_map-2-line1"></i><span>最近发布</span></div>
<div class="aside-list">
<!-- 最新文章,用户可以自定义展示数量 -->
<div class="aside-list-item" th:each="post : ${postFinder.list({page: 1, size: #conversions.convert(theme.config.sidebar.recentPost, 'java.lang.Integer'), sort: {'spec.publishTime,desc'}})}">
<div class="aside-list-item" th:each="post : ${postFinder.list({page: 1, size: theme.config.sidebar.recentPost, sort: {'spec.publishTime,desc'}})}">
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<img th:alt="${post.spec.title}"
th:with="img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : thumbnail.gen(post.spec.cover, 's')}"
Expand Down
2 changes: 1 addition & 1 deletion templates/modules/widgets/aside/visit-posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="item-headline"><i class="haofont hao-icon-eicon_map-2-line1"></i><span>热门文章</span></div>
<div class="aside-list">
<!-- 热门文章,用户可以自定义展示数量 -->
<div class="aside-list-item" th:each="post : ${postFinder.list({page: 1, size: #conversions.convert(theme.config.sidebar.recentPost, 'java.lang.Integer'), sort: {'stats.visit,desc'}})}">
<div class="aside-list-item" th:each="post : ${postFinder.list({page: 1, size: theme.config.sidebar.recentPost, sort: {'stats.visit,desc'}})}">
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<img th:alt="${post.spec.title}"
th:with="img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : thumbnail.gen(post.spec.cover, 's')}"
Expand Down
5 changes: 2 additions & 3 deletions templates/modules/widgets/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@
<div class="author-content-item-tips">标签</div>
<span class="author-content-item-title">寻找感兴趣的领域</span>
</div>
<div class="card-tag-cloud" th:with="tags = ${tagFinder.listAll()}, tagQuantity = ${#conversions.convert(theme.config.sidebar.tagQuantity, 'java.lang.Integer')}">
<div class="card-tag-cloud" th:with="tags = ${tagFinder.list(1,theme.config.sidebar.tagQuantity)}">
<a style="font-size:1em;color:#d3d3d3"
th:each="tag,iterStat : ${tags}"
th:href="@{${tag.status.permalink}}"
th:if="${tagQuantity >= 0 && iterStat.index < tagQuantity || tagQuantity < 0}">
th:href="@{${tag.status.permalink}}">
[[${tag.spec.displayName}]]<sup th:text="${tag.status.visiblePostCount}"></sup>
</a>
</div>
Expand Down
15 changes: 9 additions & 6 deletions templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,15 @@ <h1 class="post-title" th:text="${post.spec.title}"></h1>
<i class="haofont hao-icon-spinner fa-spin"></i>
</span>
</a>
<a class="post-meta-editor" sec:authorize="isAuthenticated()" data-flag-title="编辑文章"
title="编辑文章"
th:attr="onclick='javascript:window.open(\''+ '/console/posts/editor?name='+${post.metadata.name}+'&returnToView=true\''+ ',' +'\'_self'+'\')'">
<i style="margin-top: 2px;" class="haofont hao-icon-bianji post-meta-icon"></i>
<span>编辑</span>
</a>
<th:block th:with="contributorLogin = ${contributorFinder.getContributor(#authentication.name)}">
<a class="post-meta-editor" sec:authorize="isAuthenticated()" data-flag-title="编辑文章"
title="编辑文章"
th:if="${contributorLogin.name} == ${post.spec.owner}"
th:attr="onclick='javascript:window.open(\''+ '/console/posts/editor?name='+${post.metadata.name}+'&returnToView=true\''+ ',' +'\'_self'+'\')'">
<i style="margin-top: 2px;" class="haofont hao-icon-bianji post-meta-icon"></i>
<span>编辑</span>
</a>
</th:block>
</div>

</div>
Expand Down

0 comments on commit a5a1597

Please sign in to comment.