aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-12-19 22:01:22 -0500
committertdro <tdro@noreply.example.com>2022-12-19 22:01:22 -0500
commit2fb41a96097f335b3e5dbeb8dd0a2ad67bde2d3f (patch)
treec8013cec910d00beed79c6e6154e4f3994d83594
parent566768fcfb3594c4861f29c7df6fc3bd14c19061 (diff)
downloadcanory-2fb41a96097f335b3e5dbeb8dd0a2ad67bde2d3f.tar.gz
canory-2fb41a96097f335b3e5dbeb8dd0a2ad67bde2d3f.tar.bz2
canory-2fb41a96097f335b3e5dbeb8dd0a2ad67bde2d3f.zip
themes/default/layouts/partials/pagination: Newer/Older Label
Simplify and flex wrap.
-rw-r--r--assets/css/default.css8
-rw-r--r--themes/default/layouts/partials/pagination.html116
2 files changed, 59 insertions, 65 deletions
diff --git a/assets/css/default.css b/assets/css/default.css
index 11a762c..cfd58c9 100644
--- a/assets/css/default.css
+++ b/assets/css/default.css
@@ -1418,15 +1418,15 @@ code-block header language-label a:hover {
}
paginator-navigation {
- padding: 1rem 1rem 0 1rem;
+ padding: 1rem 0.25rem 0 0.25rem;
display: flex;
align-items: center;
justify-content: center;
+ flex-wrap: wrap;
}
-paginator-navigation a,
-paginator-navigation button {
- margin: 0 0.25rem;
+paginator-navigation a {
+ margin: 0 0.25rem 0.5rem 0.25rem;
font-size: 85%;
display: flex;
align-items: center;
diff --git a/themes/default/layouts/partials/pagination.html b/themes/default/layouts/partials/pagination.html
index 4c2d97f..31bebeb 100644
--- a/themes/default/layouts/partials/pagination.html
+++ b/themes/default/layouts/partials/pagination.html
@@ -1,73 +1,67 @@
{{- with .Paginator -}}
+
+ {{- $first := "Newest" -}}
+ {{- $prev := "Newer" -}}
+ {{- $next := "Older" -}}
+ {{- $last := "Oldest" -}}
+ {{- $invisible := "data-invisible" -}}
+
+ {{- $firstData := $invisible -}}
+ {{- $firstHref := "" -}}
+ {{- $firstTitle := $first -}}
+
+ {{- if and .HasPrev .First -}}
+ {{- $firstData = "" -}}
+ {{- $firstHref = .First.URL -}}
+ {{- end -}}
+
+ {{- $prevData := $invisible -}}
+ {{- $prevHref := "" -}}
+ {{- $prevRel := "prev" -}}
+ {{- $prevTitle := $prev -}}
+
+ {{- with .Prev -}}
+ {{- $prevData = "" -}}
+ {{- $prevHref = .URL -}}
+ {{- end -}}
+
+ {{- $nextData := $invisible -}}
+ {{- $nextHref := "" -}}
+ {{- $nextRel := "next" -}}
+ {{- $nextTitle := $next -}}
+
+ {{- if .Next -}}
+ {{- $nextData = "" -}}
+ {{- $nextHref = .Next.URL -}}
+ {{- end -}}
+
+ {{- $lastData := $invisible -}}
+ {{- $lastHref := "" -}}
+ {{- $lastTitle := $last -}}
+
+ {{- if and .HasNext .Last -}}
+ {{- $lastData = "" -}}
+ {{- $lastHref = .Last.URL -}}
+ {{- end -}}
+
<paginator-navigation{{ if eq .TotalPages 1 }} hidden {{ end }}>
- {{ if and .HasPrev .First }}
- <a
- href="{{ .First.URL }}"
- title="First"
- >
- First
+
+ <a {{ $firstData | safeHTMLAttr }} href="{{ $firstHref }}" title="{{ $firstTitle }}" >
+ {{ $firstTitle }}
</a>
- {{ else }}
- <button
- data-invisible
- title="Disabled"
- >
- First
- </button>
- {{- end -}}
- {{ with .Prev }}
- <a
- rel="prev"
- title="Back"
- href="{{ .URL }}"
- >
+ <a rel="{{ $prevRel }}" {{ $prevData | safeHTMLAttr }} href="{{ $prevHref }}" title="{{ $prevTitle }}">
{{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-left.svg")) }}
- Back
+ {{ $prevTitle }}
</a>
- {{ else }}
- <button
- data-invisible
- title="Disabled"
- >
- {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-left.svg")) }}
- Back
- </button>
- {{- end -}}
- {{ if .Next }}
- <a
- rel="next"
- title="Next"
- href="{{ .Next.URL }}"
- >
- Next
+ <a rel="{{ $nextRel }}" {{ $nextData | safeHTMLAttr }} href="{{ $nextHref }}" title="{{ $nextTitle }}">
+ {{ $nextTitle }}
{{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-right.svg")) }}
</a>
- {{ else }}
- <button
- data-invisible
- title="Disabled"
- >
- Next
- {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-right.svg")) }}
- </button>
- {{- end -}}
- {{ if and .HasNext .Last }}
- <a
- href="{{ .Last.URL }}"
- title="Last"
- >
- Last
+ <a {{ $lastData | safeHTMLAttr }} href="{{ $lastHref }}" title="{{ $lastTitle }}" >
+ {{ $lastTitle }}
</a>
- {{ else }}
- <button
- data-invisible
- title="Disabled"
- >
- Last
- </button>
- {{- end -}}
</paginator-navigation>
-{{ end }}
+{{- end -}}