@@ 1171,6 1171,7 @@ func (s *Service) PopularLinkList(c echo.Context) error {
"links": links,
"isPopular": true,
"navFlag": "popular",
+ "tagFilter": "",
}
if search != "" {
gmap["search"] = search
@@ 1241,7 1242,7 @@ func (s *Service) OrgLinksList(c echo.Context) error {
}
}`)
- var isOrgLink bool
+ var isOrgLink, advancedSearch bool
var navFlag string
org := &models.Organization{}
if c.Path() != c.Echo().Reverse(s.RouteName("recent_link_list")) {
@@ 1266,6 1267,7 @@ func (s *Service) OrgLinksList(c echo.Context) error {
org = orgs[0]
isOrgLink = true
navFlag = "bookmarks"
+ advancedSearch = true
} else {
navFlag = "recent"
}
@@ 1368,7 1370,7 @@ func (s *Service) OrgLinksList(c echo.Context) error {
"tagFilter": strings.Replace(tag, ",", ", ", -1),
"excludeTagFilter": strings.Replace(excludeTag, ",", ", ", -1),
"navFlag": navFlag,
- "advancedSearch": true,
+ "advancedSearch": advancedSearch,
"hasUnreadFilter": hasUnreadFilter,
"hasStarredFilter": hasStarredFilter,
"hasAllFilter": hasAllFilter,
@@ 5,6 5,16 @@ var form = document.getElementById("advanced-search");
var btn = document.getElementById("advanced-search-btn")
var tagInputDiv = document.getElementById("advanced-search-tags")
+function slugify(s) {
+ if (s === ", ") {
+ return ""
+ }
+ var re = /[^a-z0-9]+/g;
+ s = s.toLowerCase().trim();
+ s = s.replace(re, "-");
+ return s.replace(/^-+|-+$/g, "");
+}
+
function autocomplete() {
tags = this.value.split(",")
tag = tags[tags.length -1].trim()
@@ 72,7 82,7 @@ form.addEventListener("submit", function(e) {
if (tagValue === "") {
form.elements.tag.disabled = true;
} else {
- tagValue = tagValue.split(", ").join(",");
+ tagValue = tagValue.split(", ").map(slugify).join(",");
if (tagValue.endsWith(",")) {
tagValue = tagValue.slice(0, -1);
}