diff --git a/BUGs b/BUGs index 085686e..fe4c041 100644 --- a/BUGs +++ b/BUGs @@ -1,18 +1,14 @@ ### fix to get this working with bs 5... -editing a book needs to use input groups - +/- buttons (add/rem say authors) are in wrong spot / input-group -get rid of font-awesome and use bootstrap5 icons -upgrade bootstrap, dataTables, etc. - - -#### BUGS (next-20) +#### BUGS (next-21) ### DB/back-end ### UI not updating after DB change: BUG-3: alter a condition, covertype, etc. and its not in drop-down list (even though db look via index is correct, e.g books.html shows updated covertype) BUG-7: if you remove a series from a book, it won't appear in the series drop-down if it is the first 'missing' book in that series -- either reset the list, or show all series always? +BUG-20: broken gui with bs5: + * series add/rem needs to lose divs inside divs of input groups (and templ) ### ordering of data in UI: BUG-6: author,series, etc. do not have explicit ordering like sub-books... sort of irritating / needs code and DB fix diff --git a/README b/README index 3345a22..9d5e33d 100644 --- a/README +++ b/README @@ -52,3 +52,5 @@ Maybe: TODO-20: ORM all books load is slow - should I lazy load all books (ajax the 2nd->last pages in, or not use ORM, and do a quick db.execute()....) TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book) + TODO-22: upgrade bootstrap, dataTables, etc. + diff --git a/main.py b/main.py index f220277..621e95c 100644 --- a/main.py +++ b/main.py @@ -745,7 +745,6 @@ def add_books_to_loan(id): add_id=int(re.findall( '\d+', field )[0]) try: db.engine.execute("insert into book_loan_link (book_id, loan_id) values ( {}, {} )".format( add_id, id )) - print("insert into book_loan_link (book_id, loan_id) values ( {}, {} )".format( add_id, id )) db.session.commit() except SQLAlchemyError as e: st.SetAlert("danger") diff --git a/templates/book.html b/templates/book.html index f060268..4154b92 100644 --- a/templates/book.html +++ b/templates/book.html @@ -4,7 +4,11 @@ {# use tmpl-series-div as a template & keep it hidden always #} @@ -89,7 +95,9 @@ function ConfirmRemoveThisSubs_ParentAndSubsFromSeries(pid,bid,rem) } function SeriesButPlus(num) { - return '
' + return '
' } function AddBookToSeries() { @@ -172,27 +180,32 @@ function RemoveBookFromSeries(sid) { function RemoveAuthorFromBook(num) { console.log("remove an author at slot: " + num ) - $('#auth-div-'+num).remove() + $('#author-'+num).remove() + $('#author-rem-'+num).remove() } function AddAuthorToBook(num) { console.log("insert a new author at slot: " + num ) div = ` -
-
- -
+ -
` div=div.replace( /NUM/g, num ) - $('#auth-div-'+(num-1)).after( div ) + $('#author-plus').prev().after(div) new_add_func_str='AddAuthorToBook('+(num+1)+')' $('#author-plus').attr( 'onclick', new_add_func_str ) + $('#author-rem-'+num).hover( + function() { $('#author-'+num).prop( 'style', 'color:red' ) }, + function() { $('#author-'+num).prop( 'style', '' ) } ) + } @@ -218,8 +231,7 @@ function AddAuthorToBook(num) { {% endif %} {% for key in keys %} -
-
+
{% if key == "genre" %}
@@ -237,16 +249,16 @@ function AddAuthorToBook(num) { {% endfor %}
{% elif key == "author" %} -
{% set cnt = namespace(idx=0) %} {% for objects in books[key] %} -
{% if cnt.idx > 0 %} -
- -
+ {% endif %} - {% for auth in author_list %} {% set aname=auth.surname+", "+auth.firstnames %} {% endfor %} -
{% set cnt.idx = cnt.idx+1 %} {% endfor %} {% if cnt.idx == 0 %} -
- {% for auth in author_list %} {% set aname=auth.surname+", "+auth.firstnames %} {% endfor %} -
{% endif %} -
- -
-
+ {% else %} -
{% set rows=4 %} {% if key == "notes" %} {% set rows=2 %} @@ -287,14 +294,12 @@ function AddAuthorToBook(num) { {% elif key == 'publisher' or key == 'owned' or key == 'covertype' or key == 'condition' or key == 'rating' %} - {{book_form[key](class="form-select" )}} + {{book_form[key](class="form-select input-group-append" )}} {% else %} - {{book_form[key](class="form-control", rows=rows )}} + {{book_form[key](class="form-control input-group-append", rows=rows )}} {% endif %} -
{% endif %} -
-
+
{% endfor %}
@@ -305,7 +310,9 @@ function AddAuthorToBook(num) { {% for s in books.series %} @@ -322,7 +329,9 @@ function AddAuthorToBook(num) {
@@ -332,7 +341,9 @@ function AddAuthorToBook(num) { {% set hiddens.txt=hiddens.txt+"".format(loop.index) %}
@@ -342,7 +353,7 @@ function AddAuthorToBook(num) { {% if books.series|length == loop.index %}
{% endif %} @@ -354,7 +365,9 @@ function AddAuthorToBook(num) {
- +
{% endif %} @@ -435,8 +448,14 @@ function AddAuthorToBook(num) { {{CheckSeriesChange.removing_series|safe}} ) {% endif %} {% endif %} + {% set cnt = namespace(idx=1) %} + {% for authors in books['author'] %} + $('#author-rem-{{cnt.idx}}').hover( + function() { $('#author-{{cnt.idx}}').prop( 'style', 'color:red' ) }, + function() { $('#author-{{cnt.idx}}').prop( 'style', '' ) } ) + {% set cnt.idx = cnt.idx+1 %} + {% endfor %} } ) - {% endblock script_content %} {% endif %} diff --git a/templates/books.html b/templates/books.html index efe11fc..811691b 100644 --- a/templates/books.html +++ b/templates/books.html @@ -54,11 +54,14 @@ {% else %} {% if cond == "Good" %} - + + {% elif cond == "Average" %} - + + {% elif cond == "Needs Replacing" %} - + + {% endif %} {% endif %} diff --git a/templates/books_for_series.html b/templates/books_for_series.html index 130aa97..ce1ba42 100644 --- a/templates/books_for_series.html +++ b/templates/books_for_series.html @@ -16,7 +16,10 @@ success: function(data){ $('#books_for_series_bit').html(data); } } ); return false;"> - + + + + + + + + {{book.title}} {% set num = SeriesBookNum( series.id, book.id ) %} diff --git a/templates/login.html b/templates/login.html index 4165083..2479b04 100644 --- a/templates/login.html +++ b/templates/login.html @@ -43,7 +43,7 @@

-  Book DB Login

+  Book DB Login
diff --git a/templates/subbooks_for_book.html b/templates/subbooks_for_book.html index 960a10d..41ca00c 100644 --- a/templates/subbooks_for_book.html +++ b/templates/subbooks_for_book.html @@ -17,7 +17,10 @@ success: function(data){ $('#sub_book_content').html(data); } } ); return false;"> - + + + + {% set state="" %} {% if loop.index == sub_books|length %} {% set state="disabled" %} @@ -29,7 +32,10 @@ success: function(data){ $('#sub_book_content').html(data); } } ); return false;"> - + + + + {{book.title}} {{book.rating}}{{book.author}}{{book.year_published}}