From ebf7fe7336de9567360bfa33e201165a4ddd1a0b Mon Sep 17 00:00:00 2001 From: citrons <citrons@mondecitronne.com> Date: Mon, 16 Jun 2025 23:22:05 -0500 Subject: click tag to filter by that tag --- apioforum/static/style.css | 5 +++++ apioforum/templates/common.html | 4 ++++ apioforum/templates/view_forum.html | 4 ++-- apioforum/templates/view_thread.html | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apioforum/static/style.css b/apioforum/static/style.css index a3d10d6..8db66b2 100644 --- a/apioforum/static/style.css +++ b/apioforum/static/style.css @@ -374,6 +374,11 @@ fieldset { margin-bottom: 15px; } max-width: 10ch; overflow: hidden; text-overflow: ellipsis; + vertical-align: middle; +} + +a.tag { + text-decoration: none; } .tag-editor { margin-left: 20px; display: inline-block; } diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index 96d00a2..829e36a 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -84,6 +84,10 @@ </{{el}}> {%- endmacro %} +{% macro tag_in_forum(forum_id,the_tag) %} +{{tag(the_tag,href=url_for('forum.view_forum',forum_id=forum_id,tagfilter=the_tag.id))}} +{% endmacro %} + {% macro ab(name,href) -%} <a class="actionbutton" href="{{href}}">{{name}}</a> {%- endmacro %} diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index ddfb950..8ab6f42 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% from 'common.html' import ts, tag, disp_user, post_url, forum_breadcrumb, ab, vote_meter, pagination_nav %} +{% from 'common.html' import ts, tag, tag_in_forum, disp_user, post_url, forum_breadcrumb, ab, vote_meter, pagination_nav %} {% block header %} <h1>{% block title %}{{forum.name}}{% endblock %} <span class="thing-id">#{{forum.id}}</span></h1> {% if forum.id != 1 %} @@ -153,7 +153,7 @@ you do not have permission to create threads in this forum </div> <div class="thread-listing-tags"> {% for the_tag in thread_tags[thread.id] %} - {{tag(the_tag)}} + {{tag_in_forum(forum.id,the_tag)}} {% endfor %} </div> <div class="thread-listing-creation"> diff --git a/apioforum/templates/view_thread.html b/apioforum/templates/view_thread.html index fa707a6..56f98e1 100644 --- a/apioforum/templates/view_thread.html +++ b/apioforum/templates/view_thread.html @@ -1,4 +1,4 @@ -{% from 'common.html' import disp_post,tag,thread_breadcrumb,vote_meter,pagination_nav %} +{% from 'common.html' import disp_post,tag_in_forum,thread_breadcrumb,vote_meter,pagination_nav %} {% extends 'base.html' %} {% block header %} <h1>{%block title %}{{thread.title}}{% endblock %} <span class="thing-id">#{{thread.id}}</span></h1> @@ -27,7 +27,7 @@ <span class="thread-top-bar-b"> {% for the_tag in tags %} - {{ tag(the_tag) }} + {{ tag_in_forum(thread.forum,the_tag) }} {% endfor %} </span> </div> -- cgit v1.2.3