moviewyrm/bookwyrm/templates/snippets/follow_button.html
2021-02-27 18:48:10 -08:00

34 lines
1.5 KiB
HTML

{% load i18n %}
{% if request.user == user or not request.user.is_authenticated %}
{% elif request.user in user.follower_requests.all %}
<div>
{% trans "Follow request already sent." %}
</div>
{% elif user in request.user.blocks.all %}
{% include 'snippets/block_button.html' %}
{% else %}
<div class="field has-addons">
<div class="control">
<form action="/follow/" method="POST" class="interaction follow-{{ user.id }} {% if request.user in user.followers.all %}hidden{%endif %}" data-id="follow-{{ user.id }}">
{% csrf_token %}
<input type="hidden" name="user" value="{{ user.username }}">
{% if user.manually_approves_followers %}
<button class="button is-small is-link" type="submit">{% trans "Send follow request" %}</button>
{% else %}
<button class="button is-small is-link" type="submit">{% trans "Follow" %}</button>
{% endif %}
</form>
<form action="/unfollow/" method="POST" class="interaction follow-{{ user.id }} {% if not request.user in user.followers.all %}hidden{%endif %}" data-id="follow-{{ user.id }}">
{% csrf_token %}
<input type="hidden" name="user" value="{{ user.username }}">
<button class="button is-small is-danger is-light" type="submit">{% trans "Unfollow" %}</button>
</form>
</div>
<div class="control">
{% include 'snippets/user_options.html' with user=user class="is-small" %}
</div>
</div>
{% endif %}