moviewyrm/bookwyrm/templates/snippets/follow_button.html

45 lines
2.2 KiB
HTML
Raw Normal View History

2021-02-28 02:48:10 +00:00
{% load i18n %}
2020-03-27 17:11:32 +00:00
{% if request.user == user or not request.user.is_authenticated %}
{% elif user in request.user.blocks.all %}
{% include 'snippets/block_button.html' with blocks=True %}
{% else %}
2021-03-26 17:32:42 +00:00
<div class="field{% if not minimal %} has-addons{% else %} mb-0{% endif %}">
<div class="control">
<form action="{% url 'follow' %}" method="POST" class="interaction follow_{{ user.id }} {% if request.user in user.followers.all or request.user in user.follower_requests.all %}is-hidden{%endif %}" data-id="follow_{{ user.id }}">
{% csrf_token %}
<input type="hidden" name="user" value="{{ user.username }}">
2021-08-07 21:38:19 +00:00
<button class="button is-small{% if not minimal %} is-link{% endif %}" type="submit">
{% if show_username %}
{% blocktrans with username=user.localname %}Follow @{{ username }}{% endblocktrans %}
{% else %}
{% trans "Follow" %}
{% endif %}
</button>
</form>
<form action="{% url 'unfollow' %}" method="POST" class="interaction follow_{{ user.id }} {% if not request.user in user.followers.all and not request.user in user.follower_requests.all %}is-hidden{%endif %}" data-id="follow_{{ user.id }}">
{% csrf_token %}
<input type="hidden" name="user" value="{{ user.username }}">
2021-03-13 22:55:09 +00:00
{% if user.manually_approves_followers and request.user not in user.followers.all %}
2021-08-07 21:38:19 +00:00
<button class="button is-small is-danger is-light" type="submit">
{% trans "Undo follow request" %}
</button>
2021-03-13 22:48:15 +00:00
{% else %}
2021-08-07 21:38:19 +00:00
<button class="button is-small is-danger is-light" type="submit">
{% if show_username %}
{% blocktrans with username=user.localname %}Unfollow @{{ username }}{% endblocktrans %}
{% else %}
{% trans "Unfollow" %}
{% endif %}
</button>
2021-03-13 22:48:15 +00:00
{% endif %}
</form>
</div>
2021-03-26 17:32:42 +00:00
{% if not minimal %}
<div class="control">
{% include 'snippets/user_options.html' with user=user class="is-small" %}
</div>
2021-03-26 17:32:42 +00:00
{% endif %}
</div>
2020-02-22 20:57:13 +00:00
{% endif %}