From b1857cbe0437060faa1fc5aa64bc4676a34acd78 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Mon, 25 Dec 2023 09:58:11 +0100 Subject: Clickable tags in Tags --- public/gallery.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'public') 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) -- cgit v1.2.3-70-g09d2