forked from mirrors/bookwyrm
code style
This commit is contained in:
parent
12810d8e34
commit
b273123708
5 changed files with 15 additions and 9 deletions
|
@ -192,6 +192,7 @@ let StatusCache = new class {
|
||||||
.forEach(item => BookWyrm.addRemoveClass(item, "is-hidden", false));
|
.forEach(item => BookWyrm.addRemoveClass(item, "is-hidden", false));
|
||||||
|
|
||||||
// Remove existing disabled states
|
// Remove existing disabled states
|
||||||
|
// BUG: this affects all shelves, not just shelving status shelves
|
||||||
button.querySelectorAll("[data-shelf-dropdown-identifier] button")
|
button.querySelectorAll("[data-shelf-dropdown-identifier] button")
|
||||||
.forEach(item => item.disabled = false);
|
.forEach(item => item.disabled = false);
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,11 @@ def related_status(notification):
|
||||||
def active_shelf(context, book):
|
def active_shelf(context, book):
|
||||||
"""check what shelf a user has a book on, if any"""
|
"""check what shelf a user has a book on, if any"""
|
||||||
if hasattr(book, "current_shelves"):
|
if hasattr(book, "current_shelves"):
|
||||||
read_shelves = [s for s in book.current_shelves if s.shelf.identifier in models.Shelf.READ_STATUS_IDENTIFIERS]
|
read_shelves = [
|
||||||
|
s
|
||||||
|
for s in book.current_shelves
|
||||||
|
if s.shelf.identifier in models.Shelf.READ_STATUS_IDENTIFIERS
|
||||||
|
]
|
||||||
return read_shelves[0] if len(read_shelves) else {"book": book}
|
return read_shelves[0] if len(read_shelves) else {"book": book}
|
||||||
|
|
||||||
shelf = (
|
shelf = (
|
||||||
|
|
|
@ -95,9 +95,10 @@ class ReadingStatus(View):
|
||||||
# unshelve the existing shelf
|
# unshelve the existing shelf
|
||||||
this_shelf = request.POST.get("shelf")
|
this_shelf = request.POST.get("shelf")
|
||||||
if (
|
if (
|
||||||
bool(current_status_shelfbook) and
|
bool(current_status_shelfbook)
|
||||||
int(this_shelf) != int(current_status_shelfbook.shelf.id) and
|
and int(this_shelf) != int(current_status_shelfbook.shelf.id)
|
||||||
current_status_shelfbook.shelf.identifier != desired_shelf.identifier
|
and current_status_shelfbook.shelf.identifier
|
||||||
|
!= desired_shelf.identifier
|
||||||
):
|
):
|
||||||
return unshelve(request, referer=referer, book_id=book_id)
|
return unshelve(request, referer=referer, book_id=book_id)
|
||||||
# don't try to unshelve a read status shelf: it has already been deleted.
|
# don't try to unshelve a read status shelf: it has already been deleted.
|
||||||
|
|
Loading…
Reference in a new issue