Initial commit
This commit is contained in:
53
themes/default/layouts/partials/dossier-summary.html
Normal file
53
themes/default/layouts/partials/dossier-summary.html
Normal file
@@ -0,0 +1,53 @@
|
||||
{{- $current := . }}
|
||||
{{- $currentTitle := .Title }}
|
||||
{{- $position := .Scratch.Get "paginationPosition" | default "up" }}
|
||||
|
||||
{{- with index .Params.dossier 0 }}
|
||||
{{- $dossierID := . }}
|
||||
{{- $allPages := site.RegularPages }}
|
||||
{{- $filtered := where $allPages "Params.dossier" "intersect" (slice $dossierID) }}
|
||||
{{- $valid := where $filtered "Weight" "gt" 0 }}
|
||||
{{- $sorted := sort $valid "Weight" }}
|
||||
|
||||
{{- if gt (len $sorted) 1 }}
|
||||
{{- $index := -1 }}
|
||||
{{- range $i, $p := $sorted }}
|
||||
{{- if eq $p.Permalink $current.Permalink }}
|
||||
{{- $index = $i }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $prev := index $sorted (sub $index 1) }}
|
||||
{{- $next := index $sorted (add $index 1) }}
|
||||
|
||||
<nav class="pagination-bar dossier-pagination {{ $position }}">
|
||||
<h2>{{ $dossierID }}</h2>
|
||||
|
||||
{{- if ge $index 1 }}
|
||||
<a class="prev-page" href="{{ $prev.RelPermalink }}">← Page précédente</a>
|
||||
{{- else }}
|
||||
<span class="disabled prev-page">← Page précédente</span>
|
||||
{{- end }}
|
||||
|
||||
<details class="page-select {{ $position }}">
|
||||
<summary>{{ $currentTitle }}</summary>
|
||||
<ul>
|
||||
{{- range $i, $p := $sorted }}
|
||||
<li>
|
||||
{{- if eq $p.Permalink $current.Permalink }}
|
||||
<span class="current">{{ $p.Title }}</span>
|
||||
{{- else }}
|
||||
<a href="{{ $p.RelPermalink }}">{{ $p.Title }}</a>
|
||||
{{- end }}
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
{{- if lt (add $index 1) (len $sorted) }}
|
||||
<a class="next-page" href="{{ $next.RelPermalink }}">Page suivante →</a>
|
||||
{{- else }}
|
||||
<span class="disabled next-page">Page suivante →</span>
|
||||
{{- end }}
|
||||
</nav>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user