From 9d9316a703523cd4f540cb490aff5af47d2d50b5 Mon Sep 17 00:00:00 2001 From: Yader Velasquez Date: Mon, 12 Feb 2024 17:11:01 -0600 Subject: [PATCH] Prevent links of already filtered tags to be clickables References: https://todo.code.netlandish.com/~netlandish/links/47 --- cmd/links/main.go | 3 +++ templates/link_list.html | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/links/main.go b/cmd/links/main.go index 653a2f8..d425a81 100644 --- a/cmd/links/main.go +++ b/cmd/links/main.go @@ -235,6 +235,9 @@ func run() error { // Convert penies to dollar amount return links.FromPenniesToFloat(amt) }, + "isTagUsedInFilter": func(tag string, activeTags string) bool { + return strings.Contains(activeTags, tag) + }, }) err = srv.LoadTemplatesFS(links.TemplateFS, "templates/*.html", "templates/*.txt") if err != nil { diff --git a/templates/link_list.html b/templates/link_list.html index 6c54b6e..c822d48 100644 --- a/templates/link_list.html +++ b/templates/link_list.html @@ -27,7 +27,7 @@

- {{.pd.Data.clear}} + {{.pd.Data.clear}}

@@ -145,7 +145,12 @@ {{if .Tags}} {{end}} -- 2.45.2