all repos — searchix @ 973345ad50f9b237714fcb364cf7f665b3909f9d

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: paginate search results

Alan Pearce
commit

973345ad50f9b237714fcb364cf7f665b3909f9d

parent

f459e84ecf7307fe2eeb7fbaa5b0c50613ec04f4

1 file changed, 19 insertions(+), 8 deletions(-)

changed files
M frontend/templates/blocks/options.gotmplfrontend/templates/blocks/options.gotmpl
@@ -1,8 +1,8 @@
-{{- template "results" .Results -}} +{{- template "results" . -}} {{- define "results" }} - <div id="results"> - {{- with . }} - {{- range .Results }} + {{- if gt .Results.Total 0 }} + <section id="results"> + {{- range .Results.Results }} <details id="{{ .Option }}"> <summary> {{ .Option }}
@@ -53,9 +53,20 @@ {{- end }}
{{- end }} </dl> </details> - {{- else }} - Nothing found {{- end }} - {{- end }} - </div> + <footer> + <nav id="pagination"> + {{- with .Prev }} + <a class="button" href="{{ . }}" rel="prev">Prev</a> + {{- end }} + {{- with .Next }} + <a class="button" href="{{ . }}" rel="next">Next</a> + {{- end }} + </nav> + <span> {{ .Results.Total }} results </span> + </footer> + </section> + {{- else }} + Nothing found + {{- end }} {{- end }}