From 920764211064521930441b96ed914034302a7470 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Sun, 5 Jan 2025 20:51:24 +0100
Subject: feat: offer to show all results on one page (if < 10000)
Implements: https://todo.sr.ht/~alanpearce/searchix/5
---
internal/components/results.templ | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
(limited to 'internal/components/results.templ')
diff --git a/internal/components/results.templ b/internal/components/results.templ
index 226b71e..fee211c 100644
--- a/internal/components/results.templ
+++ b/internal/components/results.templ
@@ -1,9 +1,9 @@
package components
import (
- "strconv"
- "go.alanpearce.eu/searchix/internal/nix"
"go.alanpearce.eu/searchix/internal/config"
+ "go.alanpearce.eu/searchix/internal/nix"
+ "strconv"
)
func convertMatch[I nix.Importable](m nix.Importable) *I {
@@ -37,6 +37,9 @@ templ Results(r ResultData) {
}
{ strconv.FormatUint(r.Results.Total, 10) } results
+ if r.Next != r.Prev && r.Results.Total < config.MaxResultsShowAll {
+ Show All
+ }
} else {
Nothing found
--
cgit 1.4.1