Follow button snippet
This commit is contained in:
parent
5b13959850
commit
808ca0bd60
4 changed files with 25 additions and 32 deletions
13
fedireads/templates/snippets/follow_button.html
Normal file
13
fedireads/templates/snippets/follow_button.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% if not request.user in user.followers.all %}
|
||||
<form action="/follow/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.username }}"></input>
|
||||
<input type="submit" value="Follow"></input>
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="/unfollow/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.username }}"></input>
|
||||
<input type="submit" value="Unfollow"></input>
|
||||
</form>
|
||||
{% endif %}
|
|
@ -11,19 +11,7 @@
|
|||
<blockquote>{{ user.summary | safe }}</blockquote>
|
||||
{% endif %}
|
||||
{% if not is_self %}
|
||||
{% if not request.user in user.followers.all %}
|
||||
<form action="/follow/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.username }}"></input>
|
||||
<input type="submit" value="Follow"></input>
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="/unfollow/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.username }}"></input>
|
||||
<input type="submit" value="Unfollow"></input>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% include 'snippets/follow_button.html' with user=user %}
|
||||
{% endif %}
|
||||
|
||||
{% if is_self %}
|
||||
|
@ -38,17 +26,7 @@
|
|||
<div>
|
||||
<a href="{{ follower.actor }}">{{ follower.username }}</a>
|
||||
{% if not request.user in follower.followers.all %}
|
||||
<form action="/follow/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ follower.username }}"></input>
|
||||
<input type="submit" value="Follow"></input>
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="/unfollow/" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ follower.username }}"></input>
|
||||
<input type="submit" value="Unfollow"></input>
|
||||
</form>
|
||||
{% include 'snippets/follow_button.html' with user=user %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
{% for result in results %}
|
||||
<div>
|
||||
<h2>{{ result.username }}</h2>
|
||||
<form action="/follow/{{ result.username }}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Follow"></input>
|
||||
</form>
|
||||
{% include 'snippets/follow_button.html' with user=result %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue