Show shelf names with suggested books

This commit is contained in:
Mouse Reeve
2020-11-06 20:36:52 -08:00
parent d31071ddb0
commit b763b7469b
4 changed files with 47 additions and 43 deletions

View File

@ -4,22 +4,37 @@
<div class="columns">
<div class="column is-one-third">
<h2 class="title is-4">Suggested books</h2>
<h2 class="title is-5">Your books</h2>
{% if not suggested_books %}
<p>There are no books here right now! Try searching for a book to get started</p>
{% else %}
<div class="tabs is-small is-toggle">
<div class="tabs is-small">
<ul>
{% for book in suggested_books %}
<li class="{% if forloop.first %}is-active{% endif %}" data-id="tab-book-{{ book.id }}">
<label for="book-{{ book.id }}" onclick="tabChange(event)"><a>{% include 'snippets/book_cover.html' with book=book size="medium" %}</a></label>
{% for shelf in suggested_books %}
{% if shelf.books.count %}
{% with shelf_counter=forloop.counter %}
<li>
<p>{{ shelf.name }}</p>
<div class="tabs is-small is-toggle">
<ul>
{% for book in shelf.books %}
<li class="{% if shelf_counter == 1 and forloop.first %}is-active{% endif %}" data-id="tab-book-{{ book.id }}">
<label for="book-{{ book.id }}" onclick="tabChange(event)"><a>{% include 'snippets/book_cover.html' with book=book size="medium" %}</a></label>
</li>
{% endfor %}
</ul>
</div>
</li>
{% endfor %}
{% endwith %}
{% endif %}
{% endfor %}
</ul>
</div>
{% for book in suggested_books %}
{% for shelf in suggested_books %}
{% with shelf_counter=forloop.counter %}
{% for book in shelf.books %}
<div>
<input class="toggle-control" type="radio" name="recent-books" id="book-{{ book.id }}" {% if forloop.first %}checked{% endif %}>
<input class="toggle-control" type="radio" name="recent-books" id="book-{{ book.id }}" {% if shelf_counter == 1 and forloop.first %}checked{% endif %}>
<div class="toggle-content hidden">
<div class="block">
{% include 'snippets/book_titleby.html' with book=book %}
@ -29,6 +44,8 @@
</div>
</div>
{% endfor %}
{% endwith %}
{% endfor %}
{% endif %}
</div>

View File

@ -68,7 +68,7 @@
<div class="field">
<label class="label" for="start_date">
Started reading
<input type="date" name="start_date" class="input" id="id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}">
<input type="date" name="start_date" class="input" id="start_id_start_date-{{ uuid }}" value="{% now "Y-m-d" %}">
</label>
</div>
</section>
@ -111,13 +111,13 @@
<div class="field">
<label class="label" for="start_date">
Started reading
<input type="date" name="start_date" class="input" id="id_start_date-{{ readthrough.id }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
<input type="date" name="start_date" class="input" id="finish_id_start_date-{{ uuid }}" value="{{ readthrough.start_date | date:"Y-m-d" }}">
</label>
</div>
<div class="field">
<label class="label" for="finish_date">
Finished reading
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ readthrough.id }}" value="{% now "Y-m-d" %}">
<input type="date" name="finish_date" class="input" id="id_finish_date-{{ uuid }}" value="{% now "Y-m-d" %}">
</label>
</div>
</section>