diff options
| author | William Hergès <william@herges.fr> | 2025-10-27 14:40:26 +0100 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-10-27 14:40:26 +0100 |
| commit | 8d000018e132583bf4797ac9cb4ce2c4e96ed8ba (patch) | |
| tree | 1e9838911d78009a3f34f65408003ece00890ed7 | |
| parent | ef3f8de38795a92dfc5d232a533c37d53794f1c8 (diff) | |
feat(section): display paginate in full list
| -rw-r--r-- | backend/router.go | 2 | ||||
| -rw-r--r-- | backend/templates/components.html | 14 | ||||
| -rw-r--r-- | backend/templates/home.html | 2 | ||||
| -rw-r--r-- | backend/templates/home_log.html | 10 | ||||
| -rw-r--r-- | backend/templates/log.html | 11 |
5 files changed, 15 insertions, 24 deletions
diff --git a/backend/router.go b/backend/router.go index 59a02e3..fd72711 100644 --- a/backend/router.go +++ b/backend/router.go @@ -17,7 +17,7 @@ import ( ) const ( - Version = "0.3.0" + Version = "0.4.0" configKey = "config" isUpdateKey = "is_update" assetsFSKey = "assets_fs" diff --git a/backend/templates/components.html b/backend/templates/components.html index 8f1bcc2..72bf40e 100644 --- a/backend/templates/components.html +++ b/backend/templates/components.html @@ -1,4 +1,4 @@ -{{define "logs_display"}} +{{define "section_display"}} <article> {{ $uri := .URI }} {{ range .Data }} <article> @@ -11,7 +11,19 @@ </article> {{ end }} <div class="pagination"> + {{ if .Paginate }} + <nav> + {{ if ne .CurrentPage 1 }}<a href="?page={{ before .CurrentPage }}">Précédent</a>{{else}} + <p></p> + {{end}} + <p>{{ .CurrentPage }}/{{ .PagesNumber }}</p> + {{ if ne .CurrentPage .PagesNumber }}<a href="?page={{ next .CurrentPage }}">Suivant</a>{{else}} + <p></p> + {{end}} + </nav> + {{ else }} <a href="/{{ $uri }}/">Voir plus</a> + {{ end }} </div> </article> {{end}} diff --git a/backend/templates/home.html b/backend/templates/home.html index 3ff9ce3..d5dbb28 100644 --- a/backend/templates/home.html +++ b/backend/templates/home.html @@ -8,7 +8,7 @@ <div> <h2>{{ .Name }}</h2> <p>{{ .Description }}</p> - {{ template "logs_display" . }} + {{ template "section_display" . }} </div> {{ end }} </main> diff --git a/backend/templates/home_log.html b/backend/templates/home_log.html deleted file mode 100644 index 28bf36a..0000000 --- a/backend/templates/home_log.html +++ /dev/null @@ -1,10 +0,0 @@ -{{define "body"}} -<main id="content"> - {{ range .Sections }} - <div class="introduction"> - <h1>{{ .Name }}</h1> - <p>{{ .Description }}</p> - </div> - {{ template "logs_display" . }} {{ end }} -</main> -{{end}} diff --git a/backend/templates/log.html b/backend/templates/log.html deleted file mode 100644 index a384459..0000000 --- a/backend/templates/log.html +++ /dev/null @@ -1,11 +0,0 @@ -{{define "body"}} -<article id="content"> - <h1>{{ .DataTitle }}</h1> - <p>{{ .Description }}</p> - <figure> - <img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" class="large" /> - <figcaption>{{ .Img.Legend }}</figcaption> - </figure> - {{ .Content }} -</article> -{{end}} |
