From 6a72c6d9dd9eae801e7bdb7318cc935f1f6f2153 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Thu, 24 Dec 2020 17:11:28 +1100 Subject: [PATCH] okay, I have series add/remove working with crazy bootstrap input-groups and jscript/jquery adding/modifying/removing divs on the fly. It works but its way complex.... Sadly, author is not properly in the input-group and should be fixed, and may well then need more crazy on-the-fly updating of divs/buttons, etc. to move plus/minus buttons into/out of the input-group appropriately --- templates/book.html | 196 +++++++++++++++++++++++++------------------- 1 file changed, 113 insertions(+), 83 deletions(-) diff --git a/templates/book.html b/templates/book.html index 0aa6349..9cdfc7d 100644 --- a/templates/book.html +++ b/templates/book.html @@ -1,43 +1,71 @@ {% extends "base.html" %} {% block main_content %} +{# use tmpl-series-div as a template & keep it hidden always #} + + - - {% set keys = [ 'title', 'author', 'publisher', 'genre', 'owned', 'covertype', 'condition', 'year_published', 'rating', 'notes', 'blurb' ] %}
{% if message|length %} @@ -193,62 +218,66 @@ function AddAuthorToBook(num) { {% endfor %}
-
- {# use series-div-0 as a template & keep it hidden always #} - + {# putting hidden inputs in between input-groups breaks formatting, so use this var to collect them and add just before form ends #} + {% set hiddens=namespace(txt='') %} {% if books.series|length %} - {% for s in books.series %} -
- {% if SeriesBookNum( s.id, books.id ) %} -
- -
-
- Book {{ SeriesBookNum( s.id, books.id ) }} of {{s.num_books}} in {{s.title}} -
- - {% else %} -
- -
-
- Contains books in {{s.title}} -
- - {% endif %} - - -
- -
- {% else %} -
- -
- + {# empty-series-dev - filler -- we use 0 AND use that number to keep track of how many series divs for add/remove #} + +
+ {% for s in books.series %} + {% set hiddens.txt=hiddens.txt+"".format(loop.index, books.id) %} + {% set hiddens.txt=hiddens.txt+"".format(loop.index,s.id) %} +
+ {% if SeriesBookNum( s.id, books.id ) %} + {% set hiddens.txt=hiddens.txt+"".format(loop.index, SeriesBookNum( s.id, books.id )) %} + {% if books.series|length > loop.index %} + {% set disabled=" disabled" %} + {% else %} + {% set disabled="" %} + {% endif %} +
+ +
+
+ Book {{ SeriesBookNum( s.id, books.id ) }} of {{s.num_books}} in  {{s.title}} +
+ {% else %} +
+ +
+
+ Contains books in  {{s.title}} +
+ {% endif %} + {% if books.series|length == loop.index %} +
+ +
+ {% endif %} +
+ {% endfor %} + {% set show_div_0 = 0 %} + {% else %} + {# empty-series-dev - filler -- we use 0 AND use that number to keep track of how many series divs for add/remove #} +
+ +
+ +
+
{% endif %} -
-
+
{% if books.child_ref|length %}
@@ -267,6 +296,7 @@ function AddAuthorToBook(num) { {% endif %}
+ {{ hiddens.txt|safe }} {% if books.loan|length %}