forked from mirrors/bookwyrm
Merge pull request #360 from mouse-reeve/shelve_buttons
Fixes unset active shelf in shelve button pulldown
This commit is contained in:
commit
56b6fb9c97
2 changed files with 1 additions and 19 deletions
|
@ -2,6 +2,7 @@
|
|||
{% if request.user.is_authenticated %}
|
||||
|
||||
{% with book.id|uuid as uuid %}
|
||||
{% active_shelf book as active_shelf %}
|
||||
<div class="field is-grouped">
|
||||
{% if active_shelf.identifier == 'read' %}
|
||||
<button class="button is-small" disabled>
|
||||
|
|
|
@ -168,25 +168,6 @@ def active_shelf(context, book):
|
|||
return shelf.shelf if shelf else None
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def shelve_button_text(context, book):
|
||||
''' check what shelf a user has a book on, if any '''
|
||||
#TODO: books can be on multiple shelves
|
||||
shelf = models.ShelfBook.objects.filter(
|
||||
shelf__user=context['request'].user,
|
||||
book=book
|
||||
).first()
|
||||
if not shelf:
|
||||
return 'Want to read'
|
||||
|
||||
identifier = shelf.shelf.identifier
|
||||
if identifier == 'to-read':
|
||||
return 'Start reading'
|
||||
if identifier == 'reading':
|
||||
return 'I\'m done!'
|
||||
return 'Read'
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
def latest_read_through(book, user):
|
||||
''' the most recent read activity '''
|
||||
|
|
Loading…
Reference in a new issue