Skip to content

Commit

Permalink
Merge pull request #14 from liuzhihang/dev
Browse files Browse the repository at this point in the history
支持分页跳转
  • Loading branch information
liuzhihang authored Nov 27, 2022
2 parents 374f248 + 7ff4290 commit 0967717
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 73 deletions.
85 changes: 36 additions & 49 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,53 +70,18 @@ spec:
placeholder: 请输入小标题
value: 更多信息请关注 GitHub
help: 支持 HTML 语法
- $formkit: repeater
if: "$get(recentTop).value"
name: bannersIconPair
label: Banner 滚动图标
help: 为空时会使用系统内置图标
value: []
children:
- $formkit: group
name: top
label: 上图标
value:
url:
name:
background:
children:
- $formkit: url
name: url
label: 路径
placeholder: 请输入图标路径
validation: "url"
- $formkit: text
name: name
label: 名称
placeholder: 请输入名称
- $formkit: color
name: background
label: 背景色
- $formkit: group
name: bottom
label: 下图标
value:
url:
name:
background:
children:
- $formkit: url
name: url
label: 路径
placeholder: 请输入图标路径
validation: "url"
- $formkit: text
name: name
label: 名称
placeholder: 请输入名称
- $formkit: color
name: background
label: 背景色
- $formkit: select
name: bannersBackground
label: 文章列表布局
value: default
options:
- label: 默认
value: default
- label: 技术栈
value: techStack
- label: 图片(WIP)
value: img
help: "Banner 底部背景,默认使用主题技术栈、自定义技术栈需要在【个人】中配置技术栈"
- $formkit: url
if: "$get(recentTop).value"
name: bikan
Expand All @@ -126,13 +91,13 @@ spec:
- $formkit: url
if: "$get(recentTop).value"
name: remen
label: 必看精选
label: 热门文章
placeholder: 请输入地址
validation: "url"
- $formkit: url
if: "$get(recentTop).value"
name: shiyong
label: 必看精选
label: 实用教程
placeholder: 请输入地址
validation: "url"
- $formkit: radio
Expand Down Expand Up @@ -500,6 +465,28 @@ spec:
placeholder: '本文是原创文章,采用 <a target="_blank" href="/cc">CC BY-NC-ND 4.0</a> 协议,完整转载请注明来自 <a href="/" target="_blank" >程序员小航</a>'
help: "版权声明内容,支持填入 HTML 标签"

- group: about
label: 个人
formSchema:
- $formkit: repeater
name: techStack
label: 技术栈
help: 个人技术栈
value: []
children:
- $formkit: text
name: name
label: 名称
placeholder: 请输入名称
- $formkit: url
name: url
label: 路径
placeholder: 请输入图标路径
validation: "url"
- $formkit: color
name: background
label: 背景色

- group: style
label: 样式(WIP)
formSchema:
Expand Down
12 changes: 10 additions & 2 deletions templates/modules/aside.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@

<!-- 侧栏部件,不包含 toc 则直接遍历 -->
<th:block th:if="${not #strings.contains(widgets, 'toc')}">
<th:block th:each="widget : ${#strings.listSplit(widgets, ',')}">
<th:block th:replace="'modules/widgets/aside/'+ ${widget}"/>
<th:block th:each="widget,iterStat : ${#strings.listSplit(widgets, ',')}">

<th:block th:if="not ${iterStat.last}">
<th:block th:replace="'modules/widgets/aside/'+ ${widget}"/>
</th:block>
<th:block th:if="${iterStat.last}">
<div class="sticky_layout">
<th:block th:replace="'modules/widgets/aside/'+ ${widget}"/>
</div>
</th:block>
</th:block>
</th:block>

Expand Down
4 changes: 2 additions & 2 deletions templates/modules/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- 社交链接,需要填入 href class title -->
<div id="footer_deal"
th:if="${not #lists.isEmpty(theme.config.footer.socialMedia)}"
th:with="socialMedias = ${theme.config.sidebar.profile.socialMedia}">
th:with="socialMedias = ${theme.config.footer.socialMedia}">
<a class="deal_link" rel="external nofollow" target="_blank"
th:each="socialMedia : ${socialMedias}"
th:href="${socialMedia.url}"
Expand Down Expand Up @@ -52,7 +52,7 @@ <h3 class="footer-title" th:text="${menuItem.status.displayName}"></h3>
</div>
<div class="footer-banner-right">
<!-- 订阅 需要 RSS 插件支持 -->
<!--<a class="footer-banner-link" href="/rss">订阅</a>-->
<a class="footer-banner-link" href="/sitemap.xml" th:if="${pluginFinder.available('PluginSitemap')}">订阅</a>
<a class="footer-banner-link" href="https://github.com/liuzhihang/halo-theme-hao">主题</a>
<a class="footer-banner-link" href="/about">关于</a>
<a class="footer-banner-link" href="https://beian.miit.gov.cn/#/Integrated/index"
Expand Down
15 changes: 7 additions & 8 deletions templates/modules/post-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
</div>


<nav id="pagination" th:if="${posts.hasPrevious() || posts.hasNext()}" th:with="totalPages = ${posts.totalPages}, pageIndex = ${posts.page}">
<nav id="pagination" th:if="${posts.hasPrevious() || posts.hasNext()}"
th:with="totalPages = ${posts.totalPages}, pageIndex = ${posts.page}">
<!-- 页面小于 7 -->
<div class="pagination" th:if="${(totalPages le 7) && (totalPages gt 0)}">

Expand All @@ -80,10 +81,10 @@
<div class="pagination_tips_prev">上页</div>
</a>

<!-- th:href="${PostFinder.list(index, posts.size)}" -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:each="index : ${#numbers.sequence(1, totalPages)}"
th:href="@{'/page/' + ${index}}"
th:text="${index}">
</a>

Expand Down Expand Up @@ -111,10 +112,10 @@


<!-- 当前页面小于等于4 -->
<!-- TODO 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:each="index:${#numbers.sequence(2,5)}"
th:each="index : ${#numbers.sequence(2,5)}"
th:href="@{'/page/' + ${index}}"
th:if="${pageIndex le 4}"
th:text="${index}">
</a>
Expand All @@ -123,23 +124,21 @@


<!-- 最后一页与当前页面之差小于等于3 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${totalPages - pageIndex le 3}">...</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:classappend="${index eq pageIndex} ? 'current'"
th:each="index : ${#numbers.sequence(totalPages - 4, totalPages - 1)}"
th:href="@{'/page/' + ${index}}"
th:if="${totalPages - pageIndex le 3}"
th:text="${index}">
</a>


<!-- 最后一页与当前页面之差大于3 且当前页面大于4 -->
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number" th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}">...</a>
<!-- 需要添加 th:href 跳转地址 -->
<a class="page-number"
th:each="index : ${#numbers.sequence(pageIndex - 1,pageIndex + 1)}"
th:href="@{'/page/' + ${index}}"
th:if="${(pageIndex gt 4) && (totalPages - pageIndex gt 3)}"
th:text="${index}">
</a>
Expand Down
32 changes: 21 additions & 11 deletions templates/modules/widgets/banner-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
th:utext="${theme.config.top.bannersTitleSmall}"></div>
</div>

<!-- 后台可配置,未配置时使用默认值-->
<div class="tags-group-all">
<div class="tags-group-wrapper" th:if="${#lists.isEmpty(theme.config.top.bannersIconPair)}">

<!-- banners 使用默认值-->
<div class="tags-group-wrapper" th:if="${#strings.equals(theme.config.top.bannersBackground, 'default')}">
<div class="tags-group-icon-pair">
<div class="tags-group-icon" style="background:#989bf8">
<img th:src="@{/assets/images/icons/AfterEffect.png}" title="AfterEffect">
Expand Down Expand Up @@ -129,17 +130,26 @@
</div>
</div>
</div>

<!-- banners 使用默认值-->
<div class="tags-group-wrapper"
th:if="${not #lists.isEmpty(theme.config.top.bannersIconPair)}"
th:with="iconPairs = ${theme.config.top.bannersIconPair}" >
<div class="tags-group-icon-pair" th:each="iconPair : ${iconPairs}">
<div class="tags-group-icon" th:style="'background:' + ${iconPair.top.background}">
<img th:src="@{${iconPair.top.url}}" th:title="${iconPair.top.name}">
</div>
<div class="tags-group-icon" th:style="'background:' + ${iconPair.bottom.background}">
<img th:src="@{${iconPair.bottom.url}}" th:title="${iconPair.bottom.name}">
th:if="${#strings.equals(theme.config.top.bannersBackground, 'techStack')}"
th:with="techs = ${theme.config.about.techStack}">
<th:block th:each="tech,iterStat : ${techs}">
<div class="tags-group-icon-pair" th:if="${iterStat.odd}">
<div class="tags-group-icon"
th:style="'background:' + ${techOdd.background}"
th:with="techOdd = ${techs.get(iterStat.index - 1)}">
<img th:src="@{${techOdd.url}}" th:title="${techOdd.name}">
</div>

<div class="tags-group-icon"
th:style="'background:' + ${techEven.background}"
th:with="techEven = ${tech}">
<img th:src="@{${techEven.url}}" th:title="${techEven.name}">
</div>
</div>
</div>
</th:block>
</div>
</div>
<!-- 随机前往一篇文章 -->
Expand Down
2 changes: 1 addition & 1 deletion templates/modules/widgets/nav-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<a class="site-page child" th:href="@{${childMenu.status.href}}">
<!-- 这里应该有一个 icon 暂时还不支持 -->
<!--<i class="fa-fw fa-duotone fa-list-timeline"></i>-->
<span th:text="${menuItem.status.displayName}"></span>
<span th:text="${childMenu.status.displayName}"></span>
</a>
</li>
</ul>
Expand Down

0 comments on commit 0967717

Please sign in to comment.