moviewyrm/bookwyrm/templates/snippets/add_to_group_button.html
Hugh Rundle 0984972b05 group membership invitations
- fix display of group information on user and group pages
- send, receive, accept and reject invitations
2021-10-02 12:30:48 +10:00

47 lines
2.3 KiB
HTML

{% load i18n %}
{% load bookwyrm_group_tags %}
{% if request.user == user or not request.user == group.user or not request.user.is_authenticated %}
{% elif user in request.user.blocks.all %}
{% include 'snippets/block_button.html' with blocks=True %}
{% else %}
<div class="field{% if not minimal %} has-addons{% else %} mb-0{% endif %}">
<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 }}">
{% if user.local %}
<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 %}
{% trans "Invite" %}
{% endif %}
</button>
{% else %}
<!-- TODO: This is an incredibly ugly hack until groups are AP enabled -->
<span><em>Remote User</em></span>
{% endif %}
</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 }}">
{% csrf_token %}
<input type="hidden" name="group" value="{{ group.id }}">
<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" %}
</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 %}
</button>
{% endif %}
</form>
</div>
</div>
{% endif %}