~netlandish/links

360d339e003d6e62a641ef9f6f8d855182d01378 — Yader Velasquez 9 months ago aa7aaa3
Slugify exclude tags
Add q (search params) to tags links.

References: https://todo.code.netlandish.com/~netlandish/links/47
2 files changed, 3 insertions(+), 2 deletions(-)

M static/js/advancedsearch.js
M templates/link_list.html
M static/js/advancedsearch.js => static/js/advancedsearch.js +1 -1
@@ 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);
        }

M templates/link_list.html => templates/link_list.html +2 -1
@@ 151,8 151,9 @@
            {{if isTagUsedInFilter .Slug $.tagFilter}}
                <small class="link-tag__item link-tag__item--simple">#{{.Name}}</small>
            {{else}}
                <!-- NOTE change to url.Values -->
                <a class="link-tag__item link-tag__item--simple"
                   href="{{if $.tagFilter}}?tag={{$.tagFilter}}{{urlquery (printf ", %s" .Slug)}}{{if $.excludeTagFilter}}&exclude={{$.excludeTagFilter}}{{end}}{{else}}?tag={{.Slug}}{{if $.excludeTagFilter}}&exclude={{$.excludeTagFilter}}{{end}}{{end}}">#{{.Name}}</a>
                   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}}</a>
            {{end}}
          {{end}}
        </div>