1
0
Fork 0

Cleans up feed page

Fixes #53
This commit is contained in:
Mouse Reeve 2020-02-21 15:39:25 -08:00
parent 0ce9677029
commit 3eb91980e0
7 changed files with 108 additions and 57 deletions

View file

@ -2,33 +2,26 @@
{% 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>
{% if shelves %}
{% for shelf in shelves %}
<h2>{{ shelf.name }}</h2>
{% for book in shelf.books %}
<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>
{% include 'snippets/shelve-button.html' with book=book %}
</div>
{% endfor %}
{% if shelf.size > shelf.books.count %}
<a href="/shelf/{{ shelf.identifier }}">See all {{ shelf.size }}</a>
{% endif %}
{% endfor %}
{% else %}
<h2>Reading Activity</h2>
<p>Start a book!</p>
{% endif %}
</div>
<div>
@ -37,11 +30,7 @@
<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>
{% include 'snippets/shelve-button.html' with book=book %}
{% endif %}
</div>
{% endfor %}

View file

@ -0,0 +1,18 @@
<div class="interaction">
{% if activity.favorites.all %}
<span>
{{ activity.favorites.count }} like(s)
</span>
{% endif %}
<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="parent" value="{{ activity.id }}"></input>
{{ comment_form.content }}
<button type="submit">Comment</button>
</form>
</div>

View file

@ -0,0 +1,7 @@
{% load fr_display %}
<form name="shelve" action="/shelve/{{ user.localname }}/{% shelve_button_identifier book %}/{{ book.id }}" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="book.id"></input>
<button type="submit">{% shelve_button_text book %}</button>
</form>

View file

@ -9,23 +9,7 @@
<p>{{ activity.rating | stars }}</p>
<p>{{ activity.content | safe }}</p>
</div>
<div class="interaction">
{% if activity.favorites.all %}
<span>
{{ activity.favorites.count }} like(s)
</span>
{% endif %}
<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>
{% include 'snippets/interaction.html' with activity=activity %}
{% elif activity.status_type == 'Note' %}
{% include 'snippets/status_banner.html' %}
<span>{{ activity.content | safe }}</span>
@ -34,6 +18,7 @@
{% include 'snippets/book.html' with book=book size=large description=True %}
</div>
{% endfor %}
{% include 'snippets/interaction.html' with activity=activity %}
{% else %}
{# generic handling for a misc activity, which perhaps should not be displayed at all #}
did {{ activity.activity_type }}