Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lxndrblz/anatole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bilz <mail@alexbilz.com>2021-08-31 16:06:00 +0300
committerGitHub <noreply@github.com>2021-08-31 16:06:00 +0300
commit02341d0bd08e58df25c74a477aa91c53ec0ae760 (patch)
tree92a7466ad7b543635a8ec8a62864e423566e66eb
parente1bfb62880c7a5da85b3b24fe0f02078f17b90ba (diff)
parenta93f3f8e7848bad6cc70c5532b0404014e2fb711 (diff)
feat: added prettier pagination (#247)
Co-authored-by: mousemin <mousemin@users.noreply.github.com>
-rw-r--r--assets/css/style.css1
-rw-r--r--layouts/index.html2
-rw-r--r--layouts/partials/pagination.html54
3 files changed, 56 insertions, 1 deletions
diff --git a/assets/css/style.css b/assets/css/style.css
index 7e56c2b..50b2fbf 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -541,6 +541,7 @@ aside {
margin: 30px;
padding: 0px 0 56px 0;
text-align: center;
+ font-size: 1.4rem;
}
.pagination ul {
diff --git a/layouts/index.html b/layouts/index.html
index 61cabf7..aa74958 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -114,7 +114,7 @@
{{ end }}
<div class="pagination">
- {{ template "_internal/pagination.html" . }}
+ {{ template "partials/pagination.html" . }}
</div>
{{ end }}
diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html
new file mode 100644
index 0000000..a5b315c
--- /dev/null
+++ b/layouts/partials/pagination.html
@@ -0,0 +1,54 @@
+{{ if gt .Paginator.TotalPages 1 }}
+ <ul class="pagination">
+ {{ $.Scratch.Set "hasPrevDots" false }}
+ {{ $.Scratch.Set "hasNextDots" false }}
+ {{ if .Paginator.HasPrev }}
+ <li class="page-item">
+ <a class="page-link" href="{{ .Paginator.Prev.URL }}">
+ <i class="fa fa-angle-left" aria-label="上一页"></i>
+ </a>
+ </li>
+
+ {{ end }}
+ {{ range .Paginator.Pagers }}
+ {{ if eq . $.Paginator }}
+ <li class="page-item">
+ <span class="page-link current">
+ {{- .PageNumber -}}
+ </span>
+ </li>
+
+ {{ else if or (or (eq . $.Paginator.First) (eq . $.Paginator.Prev)) (or (eq . $.Paginator.Next) (eq . $.Paginator.Last )) }}
+ <li class="page-item">
+ <a class="page-link" href="{{ .URL }}">
+ {{- .PageNumber -}}
+ </a>
+ </li>
+
+ {{ else }}
+ {{ if and (not ($.Scratch.Get "hasPrevDots")) (lt .PageNumber $.Paginator.PageNumber) }}
+ {{ $.Scratch.Set "hasPrevDots" true }}
+ <span class="page-link dots">&hellip;</span>
+
+ {{ else if and (not ($.Scratch.Get "hasNextDots")) (gt .PageNumber $.Paginator.PageNumber) }}
+ {{ $.Scratch.Set "hasNextDots" true }}
+ <span class="page-link dots">&hellip;</span>
+
+ {{ end }}
+
+
+ {{ end }}
+
+
+ {{ end }}
+ {{ if .Paginator.HasNext }}
+ <li class="page-item">
+ <a class="page-link" href="{{ .Paginator.Next.URL }}">
+ <i class="fa fa-angle-right" aria-label="下一页"></i>
+ </a>
+ </li>
+
+ {{ end }}
+ </ul>
+
+{{ end }}