Re-add tags to book page

This commit is contained in:
Mouse Reeve
2020-04-04 13:12:15 -07:00
parent f35cae49b3
commit 630c94a34a
6 changed files with 41 additions and 30 deletions

View File

@ -48,14 +48,8 @@
<p><a href="/editions/{{ book.parent_work.id }}">{{ book.parent_work.edition_set.count }} editions</a></p>
{% endif %}
<div id="tag-cloud">
{% for tag in tags %}
{% include 'snippets/tag.html' with tag=tag user=request.user user_tags=user_tag_names %}
{% endfor %}
</div>
{% if request.user.is_authenticated %}
<div>
{% if request.user.is_authenticated %}
<h3>Leave a review</h3>
<form class="review-form" name="review" action="/review/" method="post">
{% csrf_token %}
@ -64,8 +58,24 @@
{{ review_form.as_p }}
<button type="submit">Post review</button>
</form>
{% endif %}
</div>
<div>
<h3>Tags</h3>
<form name="tag" action="/tag/" method="post">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.fedireads_key }}"></input>
<input type="text" name="name"></input>
<button type="submit">Add tag</button>
</form>
</div>
<div class="tag-cloud">
{% for tag in tags %}
{% include 'snippets/tag.html' with book=book tag=tag user_tags=user_tags %}
{% endfor %}
</div>
{% endif %}
</div>
</div>

View File

@ -3,9 +3,9 @@
{% block content %}
<div class="content-container">
<h2>Recently Added Books</h2>
<div class="book-grid row wrap">
<div class="book-grid row wrap shrink">
{% for book in books %}
<div class="book-preview">
<div class="cover-container">
<a href="{{ book.absolute_id }}">
{% include 'snippets/book_cover.html' with book=book %}
</a>

View File

@ -1,12 +1,16 @@
{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
<div id="content">
<div>
<h2>Books tagged "{{ tag.name }}"</h2>
<div class="content-container">
<h2>Books tagged "{{ tag.name }}"</h2>
<div class="book-grid row wrap shrink">
{% for book in books.all %}
<div class="book-preview grid">
{% include 'snippets/book.html' with book=book size=large %}
<div class="cover-container">
<a href="{{ book.absolute_id }}">
{% include 'snippets/book_cover.html' with book=book %}
</a>
{% include 'snippets/rate_action.html' with user=request.user book=book %}
{% include 'snippets/shelve_button.html' with book=book %}
</div>
{% endfor %}
</div>