From 63dc457f22d72b52b68e997eacfb8549c41044a8 Mon Sep 17 00:00:00 2001 From: Yader Velasquez Date: Tue, 13 Feb 2024 11:10:59 -0600 Subject: [PATCH] Fix and improvements for UI. References: https://todo.code.netlandish.com/~netlandish/links/47 --- core/routes.go | 13 ++++++- static/css/style.css | 14 ------- static/js/advancedsearch.js | 9 +---- templates/link_list.html | 76 ++++++++++++++++++------------------- 4 files changed, 51 insertions(+), 61 deletions(-) diff --git a/core/routes.go b/core/routes.go index 105a2b6..20efa21 100644 --- a/core/routes.go +++ b/core/routes.go @@ -1242,8 +1242,10 @@ func (s *Service) OrgLinksList(c echo.Context) error { } }`) - var isOrgLink, advancedSearch bool - var navFlag string + var ( + isOrgLink, advancedSearch bool + currURL, navFlag string + ) org := &models.Organization{} if c.Path() != c.Echo().Reverse(s.RouteName("recent_link_list")) { // This means that we want to see a specific org (private or businnes) @@ -1268,8 +1270,14 @@ func (s *Service) OrgLinksList(c echo.Context) error { isOrgLink = true navFlag = "bookmarks" advancedSearch = true + if c.Param("slug") == slug { + currURL = c.Echo().Reverse(s.RouteName("org_link_list"), slug) + } else { + currURL = c.Echo().Reverse(s.RouteName("home_link_list")) + } } else { navFlag = "recent" + currURL = c.Echo().Reverse(s.RouteName("recent_link_list")) } if c.QueryParam("next") != "" { op.Var("after", c.QueryParam("next")) @@ -1374,6 +1382,7 @@ func (s *Service) OrgLinksList(c echo.Context) error { "hasUnreadFilter": hasUnreadFilter, "hasStarredFilter": hasStarredFilter, "hasAllFilter": hasAllFilter, + "currURL": currURL, } if search != "" { diff --git a/static/css/style.css b/static/css/style.css index 99d6d66..389d633 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -494,17 +494,3 @@ a.bullet-link:before { padding: 0 2px 0 3px; opacity: 1 !important; } - -#advanced-search-container { - width: 35%; -} - -.advanced-search-inputs { - display: flex; - flex-direction: row; -} - -.advanced-search-inputs > div { - padding: 5px; -} - diff --git a/static/js/advancedsearch.js b/static/js/advancedsearch.js index 124f345..8944ac0 100644 --- a/static/js/advancedsearch.js +++ b/static/js/advancedsearch.js @@ -1,9 +1,9 @@ var url = document.querySelector('body').getAttribute('data-autocomplete'); var tagSelectors = document.querySelectorAll(".tag-selector"); -var form = document.getElementById("advanced-search"); +var form = document.getElementById("advanced-search-form"); var btn = document.getElementById("advanced-search-btn") -var tagInputDiv = document.getElementById("advanced-search-tags") +var tagInputDiv = document.getElementById("advanced-search-div") function slugify(s) { if (s === ", ") { @@ -71,14 +71,9 @@ tagSelectors.forEach(function(tagSelector) { form.addEventListener("submit", function(e) { e.preventDefault(); - var qValue = form.elements.q.value; var tagValue = form.elements.tag.value; var excludeValue = form.elements.exclude.value; - // Desactivar los elementos con valores vacĂ­os - if (qValue === "") { - form.elements.q.disabled = true; - } if (tagValue === "") { form.elements.tag.disabled = true; } else { diff --git a/templates/link_list.html b/templates/link_list.html index 120bd25..8579776 100644 --- a/templates/link_list.html +++ b/templates/link_list.html @@ -1,46 +1,46 @@ {{template "base" .}} -