bookwyrm/fedireads/templates/feed.html
2020-02-19 00:13:06 -08:00

97 lines
3.7 KiB
HTML

{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
<div id="sidebar">
<div>
<h2>Currently Reading</h2>
{# listing books currently on user's shelves #}
{% if not reading.books.all %}
<p>Start a book!</p>
{% for book in to_read.books.all %}
<div class="book-preview">
{% include 'snippets/book.html' with book=book size="small" %}
<form name="shelve" action="/shelve/{{ user.localname }}/reading/{{ book.id }}" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="book.id"></input>
<button type="submit">Start reading</button>
</form>
</div>
{% endfor %}
{% endif %}
{% for book in reading.books.all %}
<div class="book-preview">
{% include 'snippets/book.html' with book=book size="small" %}
<form name="shelve" action="/shelve/{{ user.localname }}/read/{{ book.id }}" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="book.id"></input>
<button type="submit">I'm done!</button>
</form>
</div>
{% endfor %}
</div>
<div>
<h2>Recently Added Books</h2>
{% for book in recent_books %}
<div class="book-preview">
{% include 'snippets/book.html' with book=book size="small" %}
{% if not book in user_books.all %}
<form name="shelve" action="/shelve/{{ user.localname }}/to-read/{{ book.id }}" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="book.id"></input>
<button type="submit">Want to read</button>
</form>
{% endif %}
</div>
{% endfor %}
</div>
</div>
<div id="feed">
{% for activity in activities %}
<div class="update">
<h2>
{% include 'snippets/avatar.html' with user=activity.user %}
{% include 'snippets/username.html' with user=activity.user %}
{% if activity.status_type == 'Review' %}
{# display a review #}
reviewed {{ activity.book.data.title }}
</h2>
<div class="book-preview review">
{% include 'snippets/book.html' with book=activity.book size=large %}
<h3>{{ activity.name }}</h3>
<p>{{ activity.rating | stars }}</p>
<p>{{ activity.content | safe }}</p>
</div>
<div class="interaction">
<form name="favorite" action="/favorite/{{ activity.id }}" method="post">
{% csrf_token %}
<button>⭐️ Like</button>
</form>
<form name="comment" action="/comment" method="post">
{% csrf_token %}
<input type="hidden" name="review" value="{{ activity.id }}"></input>
{{ comment_form.content }}
<button type="submit">Comment</button>
</form>
</div>
{% elif activity.status_type == 'Note' %}
posted</h2>
{{ activity.content | safe }}
{% for book in activity.mention_books.all %}
<div class="book-preview review">
{% include 'snippets/book.html' with book=book size=large description=True %}
</div>
{% endfor %}
{% else %}
{# generic handling for a misc activity, which perhaps should not be displayed at all #}
did {{ activity.activity_type }}
</h2>
{% endif %}
</div>
{% endfor %}
</div>
{% endblock %}