diff options
author | citrons <citrons@mondecitronne.com> | 2025-06-16 21:25:10 -0500 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2025-06-17 12:05:16 +0100 |
commit | 866e64f6a3dcfb93a107ce2a04099f4013a329f0 (patch) | |
tree | 11d3cd92e5a6cbc947180a54f4c7be01c87b15e5 /apioforum/templates | |
parent | 0e27f0d095c64a75f52a53860b138da923ad3555 (diff) |
forum tag editor
Diffstat (limited to 'apioforum/templates')
-rw-r--r-- | apioforum/templates/common.html | 3 | ||||
-rw-r--r-- | apioforum/templates/tags.html | 48 | ||||
-rw-r--r-- | apioforum/templates/view_forum.html | 1 |
3 files changed, 51 insertions, 1 deletions
diff --git a/apioforum/templates/common.html b/apioforum/templates/common.html index a24272b..96d00a2 100644 --- a/apioforum/templates/common.html +++ b/apioforum/templates/common.html @@ -75,7 +75,8 @@ {% endif %} <{{el}} class="tag" - style="color: {{the_tag.text_colour}}; background-color: {{the_tag.bg_colour}}" + style="color: {{the_tag.text_colour|sanitize_color}}; background-color: {{the_tag.bg_colour|sanitize_color}}" + title="{{-the_tag.name-}}" {% if href is not none -%} href="{{href}}" {%- endif -%}> diff --git a/apioforum/templates/tags.html b/apioforum/templates/tags.html new file mode 100644 index 0000000..11377df --- /dev/null +++ b/apioforum/templates/tags.html @@ -0,0 +1,48 @@ +{% from 'common.html' import tag with context %} +{% extends 'base.html' %} +{% block header %} +<h1>{% block title %}tags in '{{forum.name}}'{% endblock %}</h1> +{% endblock %} + +{% macro tag_form(t) %} +<tr> + {%set id = "tag-" + t.id|string + "-"%} + {% if not t or t.forum == forum.id%} + {%set disabled = ""%} + {%else%} + {%set disabled = " disabled "%} + {%endif%} + <td>{%if t%}{{tag(t)}}{%endif %} + <td><input {{disabled}} type="text" required form="tags" name="{{id}}name" value="{{t.name}}"/> + <td><input {{disabled}} type="text" required form="tags" name="{{id}}fg" value="{{t.text_colour}}"/> + <td><input {{disabled}} type="text" required form="tags" name="{{id}}bg" value="{{t.bg_colour}}"/> + <td><input {{disabled}} type="checkbox" form="tags" name="{{id}}enabled" + {% if t.enabled == 1%}checked{% endif %}/> +</tr> +{% endmacro %} + +{% block content %} +<h2>tags</h2> +<div class="tag-editor"> + <table> + <tr><th><th>name<th>foreground<th>background<th>enabled + {%for tag in tags%} + {{tag_form(tag)}} + {%endfor %} + </table> + + <form class="new-tag" method="POST" action="{{url_for('forum.new_tag',forum_id=forum.id)}}"> + <input type="submit" value="create new tag"/> + </form> +</div> + +<form id="tags" method="POST"> + <p>confirm changes?</p> + <p> + <input type="submit" value="confirm"> + <a href="{{url_for('forum.view_forum',forum_id=forum.id)}}">cancel</a> + </p> +</form> + +{% endblock %} + diff --git a/apioforum/templates/view_forum.html b/apioforum/templates/view_forum.html index 7640439..b7309bf 100644 --- a/apioforum/templates/view_forum.html +++ b/apioforum/templates/view_forum.html @@ -33,6 +33,7 @@ {{ab("forum settings",url_for('forum.edit_forum',forum_id=forum.id))}} {{ab("role/permission settings",url_for('forum.edit_roles',forum_id=forum.id))}} {{ab("assign roles",url_for('forum.view_user_role',forum_id=forum.id))}} + {{ab("edit tags",url_for('forum.edit_tags',forum_id=forum.id))}} {% endif %} {% if has_permission(forum.id, g.user, "p_create_subforum") %} {{ab("create subforum",url_for('forum.create_forum',forum_id=forum.id))}} |