refactor(theme): improve archive link resolution logic and dynamic tab naming
这个提交包含在:
@@ -14,7 +14,13 @@
|
||||
<i class="i-pixelarticons-github"></i>
|
||||
</span>
|
||||
|
||||
<th:block th:with="items=${theme.config.activity.activity_items}">
|
||||
<th:block
|
||||
th:with="items=${theme.config.activity.activity_items},
|
||||
primaryMenu=${menuFinder.getPrimary()},
|
||||
archiveMenuItem=${primaryMenu != null and primaryMenu.menuItems != null and !#lists.isEmpty(primaryMenu.menuItems) ? primaryMenu.menuItems.^[status != null and !#strings.isEmpty(status.href) and ((spec != null and spec.href == '/archives') or status.href == '/archives' or status.displayName == 'Archives' or status.displayName == '归档')] : null},
|
||||
archiveActivityItem=${items != null and !#lists.isEmpty(items) ? items.^[type == 'archive' or key == 'archive'] : null},
|
||||
activityArchiveHref=${archiveMenuItem != null and archiveMenuItem.status != null and !#strings.isEmpty(archiveMenuItem.status.href) ? archiveMenuItem.status.href : (archiveActivityItem != null and !#strings.isEmpty(archiveActivityItem.url) ? archiveActivityItem.url : (archiveActivityItem != null and !#strings.isEmpty(archiveActivityItem.href) ? archiveActivityItem.href : '/archives'))}"
|
||||
>
|
||||
<div class="devcm-activity__group devcm-activity__group--up">
|
||||
<th:block th:if="${items != null and !#lists.isEmpty(items)}">
|
||||
<th:block
|
||||
@@ -22,7 +28,8 @@
|
||||
th:with="placement=${#strings.isEmpty(item.position) ? 'up' : item.position},
|
||||
itemType=${!#strings.isEmpty(item.type) ? item.type : (!#strings.isEmpty(item.key) ? item.key : 'custom')},
|
||||
entryAction=${itemType == 'search' or item.action == 'search' ? 'search' : 'link'},
|
||||
entryHref=${entryAction == 'search' ? '#' : (!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#'))},
|
||||
entryConfiguredHref=${!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#')},
|
||||
entryHref=${entryAction == 'search' ? '#' : (itemType == 'archive' ? activityArchiveHref : entryConfiguredHref)},
|
||||
entryLabel=${!#strings.isEmpty(item.label) ? item.label : (!#strings.isEmpty(item.labelKey) ? #messages.msg(item.labelKey) : #messages.msg('devcm.activity.link'))}"
|
||||
>
|
||||
<a
|
||||
@@ -95,7 +102,8 @@
|
||||
<a
|
||||
class="devcm-activity__button"
|
||||
th:classappend="${pageType == 'archive' or pageType == 'post'} ? ' devcm-activity__button--active' : ''"
|
||||
href="/archives"
|
||||
href="#"
|
||||
th:href="${activityArchiveHref}"
|
||||
th:title="#{devcm.activity.archive}"
|
||||
th:attr="data-label=#{devcm.activity.archive},aria-label=#{devcm.activity.archive}"
|
||||
>
|
||||
@@ -129,7 +137,8 @@
|
||||
th:with="placement=${#strings.isEmpty(item.position) ? 'up' : item.position},
|
||||
itemType=${!#strings.isEmpty(item.type) ? item.type : (!#strings.isEmpty(item.key) ? item.key : 'custom')},
|
||||
entryAction=${itemType == 'search' or item.action == 'search' ? 'search' : 'link'},
|
||||
entryHref=${entryAction == 'search' ? '#' : (!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#'))},
|
||||
entryConfiguredHref=${!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#')},
|
||||
entryHref=${entryAction == 'search' ? '#' : (itemType == 'archive' ? activityArchiveHref : entryConfiguredHref)},
|
||||
entryLabel=${!#strings.isEmpty(item.label) ? item.label : (!#strings.isEmpty(item.labelKey) ? #messages.msg(item.labelKey) : #messages.msg('devcm.activity.link'))}"
|
||||
>
|
||||
<a
|
||||
|
||||
在新议题中引用
屏蔽一个用户