mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-01 22:11:16 +00:00
remove user button for groups
This commit is contained in:
parent
0984972b05
commit
5237e88aba
2 changed files with 25 additions and 18 deletions
|
@ -20,24 +20,8 @@
|
|||
<span class="is-sr-only">Manager</span>
|
||||
</span>
|
||||
{% endif %}
|
||||
<!-- TODO: change this to a remove_from_group button -->
|
||||
{% include 'snippets/add_to_group_button.html' with user=member group=group minimal=True %}
|
||||
{% if member.mutuals %}
|
||||
<p class="help">
|
||||
{% blocktrans trimmed with mutuals=member.mutuals|intcomma count counter=member.mutuals %}
|
||||
{{ mutuals }} follower you follow
|
||||
{% plural %}
|
||||
{{ mutuals }} followers you follow{% endblocktrans %}
|
||||
</p>
|
||||
{% elif member.shared_books %}
|
||||
<p class="help">
|
||||
{% blocktrans trimmed with shared_books=member.shared_books|intcomma count counter=member.shared_books %}
|
||||
{{ shared_books }} book on your shelves
|
||||
{% plural %}
|
||||
{{ shared_books }} books on your shelves
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% elif request.user in member.following.all %}
|
||||
{% include 'snippets/remove_from_group_button.html' with user=member group=group minimal=True %}
|
||||
{% if request.user in member.following.all %}
|
||||
<p class="help">
|
||||
{% trans "Follows you" %}
|
||||
</p>
|
||||
|
|
23
bookwyrm/templates/snippets/remove_from_group_button.html
Normal file
23
bookwyrm/templates/snippets/remove_from_group_button.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% 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 'remove-group-member' %}" method="POST" class="interaction add_{{ user.id }}" 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 is-danger is-light" type="submit">
|
||||
{% if show_username %}
|
||||
{% blocktrans with username=user.localname %}Remove @{{ username }}{% endblocktrans %}
|
||||
{% else %}
|
||||
{% trans "Remove" %}
|
||||
{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
Loading…
Reference in a new issue