From fae995e48608a48cd172f49e4849d91827d7d4db Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 5 Nov 2023 14:20:41 -0700 Subject: [PATCH] Gallery: Retain search filters when toggling card types --- pkg/templates/template_funcs.go | 5 +++++ web/templates/photo/gallery.html | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/templates/template_funcs.go b/pkg/templates/template_funcs.go index 30753e2..edf61d8 100644 --- a/pkg/templates/template_funcs.go +++ b/pkg/templates/template_funcs.go @@ -7,6 +7,7 @@ import ( "html/template" "net/http" "net/url" + "sort" "strings" "time" @@ -211,6 +212,10 @@ func QueryPlus(r *http.Request) func(...interface{}) template.URL { ) } } + + // Sort them deterministically. + sort.Strings(parts) + return template.URL(strings.Join(parts, "&")) } } diff --git a/web/templates/photo/gallery.html b/web/templates/photo/gallery.html index cba81a1..4b5fac5 100644 --- a/web/templates/photo/gallery.html +++ b/web/templates/photo/gallery.html @@ -212,10 +212,10 @@
@@ -345,6 +345,9 @@ + + +