Make progress updates toggle-able

Also move into their own section
This commit is contained in:
Joel Bradshaw 2020-11-18 19:05:52 -08:00
parent c9b2b4efac
commit ff7d87b1c4
2 changed files with 12 additions and 4 deletions

View file

@ -78,10 +78,6 @@
<dt>On page:</dt> <dt>On page:</dt>
<dd>{{ readthrough.pages_read }} of {{ book.pages }}</dd> <dd>{{ readthrough.pages_read }} of {{ book.pages }}</dd>
{% endif %} {% endif %}
{% for progress_update in readthrough.progress_updates %}
<dt>On {{ progress_update.date | naturalday }} you were on:</dt>
<dd>{{ progress_update.progress }} of {{ book.pages }}</dd>
{% endfor %}
</dl> </dl>
<div class="field is-grouped"> <div class="field is-grouped">
<label class="button is-small" for="edit-readthrough-{{ readthrough.id }}" role="button" tabindex="0"> <label class="button is-small" for="edit-readthrough-{{ readthrough.id }}" role="button" tabindex="0">
@ -95,6 +91,17 @@
</span> </span>
</label> </label>
</div> </div>
{% if show_progress %}
Progress Updates:
<dl class="progress-updates">
{% for progress_update in readthrough.progress_updates %}
<dt>{{ progress_update.date | naturalday }}:</dt>
<dd>{{ progress_update.progress }} of {{ book.pages }}</dd>
{% endfor %}
</dl>
{% elif readthrough.progress_updates|length %}
<a href="?showprogress">Show {{ readthrough.progress_updates|length }} Progress Updates</a>
{% endif %}
</div> </div>
</div> </div>

View file

@ -581,6 +581,7 @@ def book_page(request, book_id):
'tags': tags, 'tags': tags,
'user_tags': user_tags, 'user_tags': user_tags,
'readthroughs': readthroughs, 'readthroughs': readthroughs,
'show_progress': ('showprogress' in request.GET),
'path': '/book/%s' % book_id, 'path': '/book/%s' % book_id,
'info_fields': [ 'info_fields': [
{'name': 'ISBN', 'value': book.isbn_13}, {'name': 'ISBN', 'value': book.isbn_13},