From 973345ad50f9b237714fcb364cf7f665b3909f9d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 May 2024 00:15:52 +0200 Subject: feat: paginate search results --- frontend/templates/blocks/options.gotmpl | 27 +++++++++++++++++++-------- frontend/templates/blocks/search.gotmpl | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'frontend/templates') diff --git a/frontend/templates/blocks/options.gotmpl b/frontend/templates/blocks/options.gotmpl index e39d60c..88553b2 100644 --- a/frontend/templates/blocks/options.gotmpl +++ b/frontend/templates/blocks/options.gotmpl @@ -1,8 +1,8 @@ -{{- template "results" .Results -}} +{{- template "results" . -}} {{- define "results" }} -
- {{- with . }} - {{- range .Results }} + {{- if gt .Results.Total 0 }} +
+ {{- range .Results.Results }}
{{ .Option }} @@ -53,9 +53,20 @@ {{- end }}
- {{- else }} - Nothing found {{- end }} - {{- end }} -
+ + + {{- else }} + Nothing found + {{- end }} {{- end }} diff --git a/frontend/templates/blocks/search.gotmpl b/frontend/templates/blocks/search.gotmpl index a4f0ee5..0be63c1 100644 --- a/frontend/templates/blocks/search.gotmpl +++ b/frontend/templates/blocks/search.gotmpl @@ -9,7 +9,7 @@ - {{- with .Results }} + {{- if .Results }} {{ block "results" . }}{{ end }} {{- end }} {{- end }} -- cgit 1.4.1