diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-12-25 09:58:11 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-12-25 09:58:11 +0100 |
commit | b1857cbe0437060faa1fc5aa64bc4676a34acd78 (patch) | |
tree | c05b647c39a8677c7a26d4c7b46f9cc510530d64 /public/gallery.js | |
parent | 234c13ca9a4f111382b9167e647f6ca05da8f1d1 (diff) | |
download | gallery-b1857cbe0437060faa1fc5aa64bc4676a34acd78.tar.gz gallery-b1857cbe0437060faa1fc5aa64bc4676a34acd78.tar.xz gallery-b1857cbe0437060faa1fc5aa64bc4676a34acd78.zip |
Clickable tags in Tags
Diffstat (limited to 'public/gallery.js')
-rw-r--r-- | public/gallery.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/public/gallery.js b/public/gallery.js index 99bfe0b..299d372 100644 --- a/public/gallery.js +++ b/public/gallery.js @@ -237,8 +237,13 @@ let TagsList = { return (tags.length == 0) ? "No tags" - : m("ul", tags.map(([name, count]) => - m("li", `${name} ×${count}`))) + : m("ul", tags.map(([name, count]) => m("li", [ + m(m.route.Link, { + href: `/search/:key`, + params: {key: `${vnode.attrs.space}:${name}`}, + }, ` ${name}`), + ` ×${count}`, + ]))) }, } @@ -255,12 +260,12 @@ let TagsView = { let children = (names.length == 0) ? "No namespaces" - : names.map(name => { - const ns = TagsModel.namespaces[name] + : names.map(space => { + const ns = TagsModel.namespaces[space] return [ - m("h2", name), + m("h2", space), ns.description ? m("p", ns.description) : [], - m(TagsList, {tags: ns.tags}), + m(TagsList, {space, tags: ns.tags}), ] }) return m('.tags[tabindex=0]', {}, children) |