优化主题服务部分代码复用性。sketch 归档页适配
This commit is contained in:
@@ -215,16 +215,12 @@ public class ThemeService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前主题
|
||||
* 获取当前主题,若为配置或不存在则取读取到的第一个主题
|
||||
* @return
|
||||
*/
|
||||
public ThemeInfo getCurrentTheme() {
|
||||
String identity = siteConfig.getThemeIdentity();
|
||||
Optional<ThemeInfo> optionalTheme = cachedThemes.stream().filter(theme -> {
|
||||
return theme.isInternal() || OSUtils.isCaseSensitiveFS() ?
|
||||
theme.getIdentity().equals(identity):
|
||||
theme.getIdentity().equalsIgnoreCase(identity);
|
||||
}).findAny();
|
||||
Optional<ThemeInfo> optionalTheme = Optional.ofNullable(getThemeInfo(identity));
|
||||
|
||||
return optionalTheme.orElseGet(() -> {
|
||||
ThemeInfo defaultTheme = cachedThemes.get(0);
|
||||
@@ -233,6 +229,11 @@ public class ThemeService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 identity 获取指定主题
|
||||
* @param identity
|
||||
* @return
|
||||
*/
|
||||
public ThemeInfo getThemeInfo(String identity) {
|
||||
Optional<ThemeInfo> optionalTheme = cachedThemes.stream().filter(theme -> {
|
||||
return theme.isInternal() || OSUtils.isCaseSensitiveFS() ?
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
</div>
|
||||
</header>
|
||||
<th:block th:each="post, i : ${posts}">
|
||||
<th:block th:with="postYear=${#dates.year(post.createTime)}">
|
||||
<th:block th:if="${i.first or postYear != #dates.year(posts[i.index - 1].createTime)}" >
|
||||
<th:block th:with="postYear=${post.createTime.year}">
|
||||
<th:block th:if="${i.first or postYear != posts[i.index - 1].createTime.year}" >
|
||||
<div class="year" th:with="year=${postYear}" th:text="${postYear}"></div>
|
||||
<th:block th:utext="'<ul>'"></th:block>
|
||||
</th:block>
|
||||
@@ -39,7 +39,7 @@
|
||||
</a></td>
|
||||
</tr></tbody></table>
|
||||
</li>
|
||||
<th:block th:if="${i.last or postYear != #dates.year(posts[i.index + 1].createTime)}" th:utext="'</ul>'"></th:block>
|
||||
<th:block th:if="${i.last or postYear != posts[i.index + 1].createTime.year}" th:utext="'</ul>'"></th:block>
|
||||
</th:block>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user