From 360d339e003d6e62a641ef9f6f8d855182d01378 Mon Sep 17 00:00:00 2001 From: Yader Velasquez Date: Tue, 13 Feb 2024 18:30:15 -0600 Subject: [PATCH] Slugify exclude tags Add q (search params) to tags links. References: https://todo.code.netlandish.com/~netlandish/links/47 --- static/js/advancedsearch.js | 2 +- templates/link_list.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/advancedsearch.js b/static/js/advancedsearch.js index a3e6b44..cc3100c 100644 --- a/static/js/advancedsearch.js +++ b/static/js/advancedsearch.js @@ -90,7 +90,7 @@ form.addEventListener("submit", function(e) { form.elements.exclude.disabled = true; } else { - excludeValue = excludeValue.split(",").join(", "); + excludeValue = excludeValue.split(",").map(slugify).join(", "); if (excludeValue.endsWith(",")) { excludeValue = excludeValue.slice(0, -1); } diff --git a/templates/link_list.html b/templates/link_list.html index 1667864..59d497a 100644 --- a/templates/link_list.html +++ b/templates/link_list.html @@ -151,8 +151,9 @@ {{if isTagUsedInFilter .Slug $.tagFilter}} #{{.Name}} {{else}} + #{{.Name}} + href="{{if $.search}}?q={{$.search}}&{{else}}?{{end}}{{if $.tagFilter}}tag={{$.tagFilter}}{{urlquery (printf ", %s" .Slug)}}{{if $.excludeTagFilter}}&exclude={{$.excludeTagFilter}}{{end}}{{else}}tag={{.Slug}}{{if $.excludeTagFilter}}&exclude={{$.excludeTagFilter}}{{end}}{{end}}">#{{.Name}} {{end}} {{end}} -- 2.45.2