Add admin capcodes

Sometimes, it is necessary for an admin or other moderator to reveal
themselves. Capcodes allow them to do so by appending a special colored
portion at the end of their name on a post.

This adds object-level permissions, so if you have a moderator who
shouldn't be able to use the "admin" capcode, you can give them
permission only to the "moderator" capcode.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-28 21:37:45 -07:00
parent 29dff20db9
commit ab749359fa
9 changed files with 110 additions and 46 deletions

View File

@@ -30,9 +30,14 @@
{% if post.subject %}
<span class="post_subject">{{post.subject}}</span>
{% endif %}
{% blocktranslate with post_name=post.name|default:"Anonymous" post_created=post.created %}
{% blocktranslate with post_name=post.name|default:"Anonymous" %}
by
<span class="post_name">{{post_name}}</span>
{% endblocktranslate %}
{% if post.capcode %}
<span class="post_capcode" style="color: {{post.capcode.color}};">{{post.capcode}}</span>
{% endif %}
{% blocktranslate with post_created=post.created %}
at {{post_created}}
{% endblocktranslate %}
{% if reply_link %}

View File

@@ -5,7 +5,23 @@
<form method="post" action="{% url 'board:reply_create' url=board.url id=post.id %}" enctype="multipart/form-data">
{% csrf_token %}
<table>
{{ form.as_table }}
{# {{ form.as_table }} #}
{% for field in form %}
{% if field.name != "capcode" %}
<tr>
<th>{{field.label_tag}}</th>
<td>{{field}}</td>
</tr>
{% endif %}
{% endfor %}
{% if capcodes %}
<tr>
<th>{{form.capcode.label_tag}}</th>
<td>
{{form.capcode}}
</td>
</tr>
{% endif %}
<tr>
<th>&nbsp;</th>
<td>