From aa7aaa338a700bbe14366b19bdeebfc77fb7ea49 Mon Sep 17 00:00:00 2001 From: Yader Velasquez Date: Tue, 13 Feb 2024 13:06:21 -0600 Subject: [PATCH] Move form to the top of the page Urlencode values for tags links References: https://todo.code.netlandish.com/~netlandish/links/47 --- static/js/advancedsearch.js | 5 +++ templates/link_list.html | 79 ++++++++++++++++++---------------- templates/link_short_list.html | 7 ++- 3 files changed, 52 insertions(+), 39 deletions(-) diff --git a/static/js/advancedsearch.js b/static/js/advancedsearch.js index e196785..a3e6b44 100644 --- a/static/js/advancedsearch.js +++ b/static/js/advancedsearch.js @@ -73,6 +73,7 @@ form.addEventListener("submit", function(e) { e.preventDefault(); var tagValue = form.elements.tag.value; var excludeValue = form.elements.exclude.value; + var qValue = form.elements.q.value if (tagValue === "") { form.elements.tag.disabled = true; @@ -95,6 +96,10 @@ form.addEventListener("submit", function(e) { } form.elements.exclude.value = excludeValue; } + + if (qValue === "") { + form.elements.q.disabled = true; + } this.submit(); }) diff --git a/templates/link_list.html b/templates/link_list.html index 27f783a..1667864 100644 --- a/templates/link_list.html +++ b/templates/link_list.html @@ -1,43 +1,46 @@ {{template "base" .}} -
-

{{ if .isOrgLink }}{{ .org.Name }} {{.pd.Title}}{{else if not .isPopular}}{{.pd.Data.recent}}{{else}}{{.pd.Data.popular}}{{end}}

- -
-
- {{if .advancedSearch}} -

{{.pd.Data.advanced_search}}

-
-
-
-
-
-
+ + + {{if .advancedSearch}} +
+
+
+
+
+
+
+
+ +
- -
- {{end}} +
+ +
+
+
+ + {{.pd.Data.clear}} +
+
+
+ {{end}} + +
{{if .isOrgLink}}

{{.pd.Data.all}} @@ -149,7 +152,7 @@ #{{.Name}} {{else}} #{{.Name}} + href="{{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}} diff --git a/templates/link_short_list.html b/templates/link_short_list.html index ec99b27..9f294d9 100644 --- a/templates/link_short_list.html +++ b/templates/link_short_list.html @@ -54,7 +54,12 @@ {{if .Tags}}

{{end}} -- 2.45.2