M core/routes.go => core/routes.go +11 -2
@@ 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 != "" {
M static/css/style.css => static/css/style.css +0 -14
@@ 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;
-}
-
M static/js/advancedsearch.js => static/js/advancedsearch.js +2 -7
@@ 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 {
M templates/link_list.html => templates/link_list.html +38 -38
@@ 1,46 1,46 @@
{{template "base" .}}
-<section class="app-header app-header-advanced-search">
+<section class="app-header">
<h1 class="app-header__title">{{ if .isOrgLink }}{{ .org.Name }} {{.pd.Title}}{{else if not .isPopular}}{{.pd.Data.recent}}{{else}}{{.pd.Data.popular}}{{end}}</h1>
- <div id="advanced-search-container">
- <form class="app-header__search app-header__search--stack" method="GET" id="advanced-search"
- action="{{if .isPopular}}{{reverse "core:popular_link_list"}}{{else if .isOrgLink}}{{reverse "core:home_link_list"}}{{else}}{{reverse "core:recent_link_list"}}{{end}}">
- <div class="app-header__search app-header__search--inline">
- <input type="search" name="q" value="{{.search}}"/>
- <button type="submit" class="button dark icon-only">
- <svg class="search-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width:20px">
- <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" />
- </svg>
- </button>
- </div>
- {{if .advancedSearch}}
- <p class="text-right"><a href="#" id="advanced-search-btn">{{.pd.Data.advanced_search}}</a></p>
- <div id="advanced-search-tags" {{if and (not .tagFilter) (not .excludeTagFilter)}}class="d-none"{{end}}>
- <div class="advanced-search-inputs">
- <div>
- <label>{{.pd.Data.include_tags}}</label>
- <input type="text" name="tag" value="{{.tagFilter}}" class="tag-selector" autocomplete="off"/>
- <div class="d-none autocomplete-tags"></div>
- </div>
- <div>
- <label>{{.pd.Data.exclude_tags}}</label>
- <input type="text" name="exclude" value="{{.excludeTagFilter}}" class="tag-selector" autocomplete="off"/>
- <div class="d-none autocomplete-tags"></div>
- </div>
- </div>
- <p class="mt-1 pull-right">
- <a href="{{reverse "core:home_link_list"}}" class="button primary is-small">{{.pd.Data.clear}}</a>
- <button type="submit" class="button primary is-small">{{.pd.Data.apply}}</button>
- </p>
- </div>
- {{end}}
- </form>
- </div>
+ <form class="app-header__search app-header__search--inline" method="GET"
+ action="{{if .isPopular}}{{reverse "core:popular_link_list"}}{{else if .isOrgLink}}{{reverse "core:home_link_list"}}{{else}}{{reverse "core:recent_link_list"}}{{end}}">
+ <input type="search" name="q" value="{{.search}}"/>
+ <button type="submit" class="button dark icon-only">
+ <svg class="search-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width:20px">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" />
+ </svg>
+ </button>
+ </form>
</section>
-
<section class="card shadow-card">
+ {{if .advancedSearch}}
+ <p><a href="#" id="advanced-search-btn">{{.pd.Data.advanced_search}}</a></p>
+ <div id="advanced-search-div" {{if and (not .tagFilter) (not .excludeTagFilter)}}class="d-none"{{end}}>
+ <form method="GET" id="advanced-search-form" action="{{.currURL}}">
+ <div class="row">
+ <div class="col-5"><label>{{.pd.Data.include_tags}}</label></div>
+ <div class="col-5"><label>{{.pd.Data.exclude_tags}}</label></div>
+ <div class="col-2"></div>
+ </div>
+ <div class="row">
+ <div class="col-5">
+ <input type="text" name="tag" value="{{.tagFilter}}" class="tag-selector" autocomplete="off"/>
+ <div class="d-none autocomplete-tags"></div>
+ </div>
+ <div class="col-5">
+ <input type="text" name="exclude" value="{{.excludeTagFilter}}" class="tag-selector" autocomplete="off"/>
+ <div class="d-none autocomplete-tags"></div>
+ </div>
+ <div class="col-2 is-right">
+ <button type="submit" class="button primary is-small">{{.pd.Data.apply}}</button>
+ <a href="{{.currURL}}" class="button primary is-small">{{.pd.Data.clear}}</a>
+ </div>
+ </div>
+ </form>
+ </div>
+ {{end}}
{{if .isOrgLink}}
<p>
- <a class="filter-btn{{if .hasAllFilter}} active{{end}}" href="{{reverse "core:home_link_list"}}">{{.pd.Data.all}}</a>
+ <a class="filter-btn{{if .hasAllFilter}} active{{end}}" href="{{.currURL}}">{{.pd.Data.all}}</a>
<a class="filter-btn{{if .hasUnreadFilter}} active{{end}}" href="?filter=unread">{{.pd.Data.unread}}</a>
<a class="filter-btn{{if .hasStarredFilter}} active{{end}}" href="?filter=starred">{{.pd.Data.starred}}</a>
</p>
@@ 145,7 145,7 @@
{{if .Tags}}
<div class="link-tag mt-1">
{{range .Tags}}
- {{if isTagUsedInFilter .Name $.tagFilter}}
+ {{if isTagUsedInFilter .Slug $.tagFilter}}
<small class="link-tag__item link-tag__item--simple">#{{.Name}}</small>
{{else}}
<a class="link-tag__item link-tag__item--simple"