aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2025-11-13 15:31:41 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2025-11-13 15:31:41 +0100
commitd18485f51156350c02b9b789fe44e14953b51f9b (patch)
treecc0074a86a547801bec61530a1ac0d114d8b99dd
parenta221da8d306d805a60dde6c231d49ac8019fa8dc (diff)
feat(template): remove 'voir plus' if no more items
-rw-r--r--[-rwxr-xr-x]LICENSE0
-rw-r--r--backend/home.go1
-rw-r--r--backend/section.go1
-rw-r--r--backend/templates/components.html4
4 files changed, 4 insertions, 2 deletions
diff --git a/LICENSE b/LICENSE
index 378e4bd..378e4bd 100755..100644
--- a/LICENSE
+++ b/LICENSE
diff --git a/backend/home.go b/backend/home.go
index 8f274e8..be01b9d 100644
--- a/backend/home.go
+++ b/backend/home.go
@@ -127,6 +127,7 @@ func handleGenericSectionDisplay(_ http.ResponseWriter, _ *http.Request, section
if len(sec.Data) == 0 {
sec.sort()
}
+ sec.LenMax = maxLogsPerPage
sec.Data = sec.Data[:min(maxLogsPerPage, len(sec.Data))]
d.Sections = append(d.Sections, &sec)
}
diff --git a/backend/section.go b/backend/section.go
index 1333f87..e6e318a 100644
--- a/backend/section.go
+++ b/backend/section.go
@@ -29,6 +29,7 @@ type Section struct {
Description string `toml:"description"`
URI string `toml:"uri"`
Data []*sectionData `toml:"-"`
+ LenMax int `toml:"-"`
Paginate bool `toml:"-"`
PagesNumber int `toml:"-"`
CurrentPage int `toml:"-"`
diff --git a/backend/templates/components.html b/backend/templates/components.html
index 5365445..b4ffbe6 100644
--- a/backend/templates/components.html
+++ b/backend/templates/components.html
@@ -21,9 +21,9 @@
<p></p>
{{end}}
</nav>
- {{ else }}
+ {{ else }} {{ if eq (len .Data) .LenMax }}
<a href="/{{ $uri }}/">Voir plus</a>
- {{ end }}
+ {{ end }} {{ end }}
</div>
</article>
{{end}}