add pagination engine to render

This commit is contained in:
2024-11-19 15:54:29 +01:00
parent aa16e20958
commit c777ef7056
7 changed files with 509 additions and 30 deletions
+34
View File
@@ -12,6 +12,40 @@
{{ .Data.message }}
{{ range .Data.elements }}
<ul>
<li>
{{ .Name }}
{{ .Description }}
</li>
</ul>
{{ end }}
{{ if not .Pages.HasPrevious }}
primera página
{{ else }}
<a href="html?page={{ .Pages.First }}">primera</a>
<a href="html?page={{ .Pages.Previous }}">anterior</a>
{{ end }}
{{ range .Pages.PageRange 5 }}
{{ if .Active }}
<strong>{{ .Number }}</strong>
{{ else }}
<a href="html?page={{ .Number }}">{{ .Number }}</a>
{{ end }}
{{ end }}
{{ if not .Pages.HasNext }}
última página
{{ else }}
<a href="html?page={{ .Pages.Next }}">siguiente</a>
<a href="html?page={{ .Pages.Last }}">última</a>
{{ end }}
</body>