From 0432f46b205142c042ac44dd701a8cfa78f0b44f Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sat, 9 Jan 2021 22:00:08 +1100 Subject: [PATCH] altered book delete status to success, completed TODO-05 (books must be sold to be deleted - with tooltip to explain), and added new BUG-17 - changing some fields of parent book need to be reflected into sub book --- BUGs | 1 + README | 1 - main.py | 5 ++--- templates/book.html | 10 +++++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/BUGs b/BUGs index 6a79290..a2dcb3c 100644 --- a/BUGs +++ b/BUGs @@ -1,4 +1,5 @@ #### BUGS (next-17) +BUG-17: if change publisher, owned, covertype, condition, or blurb of parent book, then need to reflect that change to ALL sub books ### DB/back-end BUG-2: series does not deal with calcd_rating... diff --git a/README b/README index 627f354..32f2411 100644 --- a/README +++ b/README @@ -30,7 +30,6 @@ sudo docker-compose -f /srv/docker/config/docker-compose.yml up bookdb_web ########################################################### TODOS (next 29): -TODO-05: should deleting really just ask if want to mark it as SOLD? IN FACT, make delete button disabled until its sold... (and a tooltip to explain) TODO-09: show books to buy view / printable Validation: diff --git a/main.py b/main.py index 407d039..741182d 100644 --- a/main.py +++ b/main.py @@ -490,9 +490,8 @@ def book(id): st.SetMessage( "This is a parent book, cannot delete it without deleting sub books first" ) return redirect( '/book/{}'.format(book.id) ) else: - st.SetAlert("warning") - st.SetMessage("WARNING: Deleting being tested at present.
") - st.AppendMessage("Deleted {}".format(book.title) ) + st.SetAlert("success") + st.SetMessage("Deleted {}".format(book.title) ) pid = 0 if len(book.parent) > 0: pid = book.parent[0].id diff --git a/templates/book.html b/templates/book.html index f36bb2b..5d31f34 100644 --- a/templates/book.html +++ b/templates/book.html @@ -366,7 +366,14 @@ function AddAuthorToBook(num) {
{{ book_form.submit( class="btn btn-primary offset-lg-2 col-lg-2" )}} {% if 'Edit' in page_title %} - {{ book_form.delete( class="btn btn-outline-danger col-lg-2" )}} + {% if GetOwnedById(b.owned) == 'Sold' %} + {{ book_form.delete( class="btn btn-outline-danger col-lg-2" )}} + {% else %} + + {{ book_form.delete( class="btn btn-outline-danger col disabled", disabled="true", style="pointer-events: none;" )}} + + {% endif %} {% endif %}
@@ -411,6 +418,7 @@ function AddAuthorToBook(num) { {% block script_content %}