groups templates improvements

- require confirmation before removing a member
- require confirmation before removing self
- make button text less verbose
- use more standardised formatting for group editing form
- improve button colours
- add missing trans tags
- reload group page when removing member
This commit is contained in:
Hugh Rundle
2021-10-16 16:43:09 +11:00
parent 1736419538
commit 85784f07d2
6 changed files with 49 additions and 63 deletions

View File

@ -5,18 +5,14 @@
{% include 'snippets/block_button.html' with blocks=True %}
{% else %}
<div class="field{% if not minimal %} has-addons{% else %} mb-0{% endif %}">
<div class="field mb-0">
<div class="control">
<form action="{% url 'invite-group-member' %}" method="POST" class="interaction add_{{ user.id }} {% if group|is_member:user or group|is_invited:user %}is-hidden{%endif %}" data-id="add_{{ user.id }}">
{% csrf_token %}
<input type="hidden" name="group" value="{{ group.id }}">
<input type="hidden" name="user" value="{{ user.username }}">
<button class="button is-small{% if not minimal %} is-link{% endif %}" type="submit">
{% if show_username %}
{% blocktrans with username=user.localname %}Invite @{{ username }}{% endblocktrans %}
{% else %}
<button class="button is-small" type="submit">
{% trans "Invite" %}
{% endif %}
</button>
</form>
<form action="{% url 'remove-group-member' %}" method="POST" class="interaction add_{{ user.id }} {% if not group|is_member:user and not group|is_invited:user %}is-hidden{% endif %}" data-id="add_{{ user.id }}">
@ -25,17 +21,13 @@
<input type="hidden" name="user" value="{{ user.username }}">
{% if not group|is_member:user %}
<button class="button is-small is-danger is-light" type="submit">
{% trans "Undo Invitation" %}
{% trans "Uninvite" %}
</button>
{% else %}
<button class="button is-small is-danger is-light" type="submit">
{% if show_username %}
{% blocktrans with username=user.localname %}Remove @{{ username }}{% endblocktrans %}
{% else %}
{% trans "Remove" %}
{% endif %}
{% blocktrans with username=user.localname %}Remove @{{ username }}{% endblocktrans %}
</button>
{% endif %}
{% endif %}
</form>
</div>
</div>