From 94b5ec91cc17864b1dbf61c06b4ee3210f42fd52 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Thu, 11 Jun 2020 08:48:23 +0200 Subject: [PATCH] Title in table translatable Edit some elements in table possible Checkbox state is kept over page change in book table Fix missing div in layout --- cps/editbooks.py | 36 +++++++++++++++++++++++ cps/templates/book_table.html | 55 ++++++++++++++++++++++++++++------- cps/templates/layout.html | 1 + cps/web.py | 14 --------- 4 files changed, 81 insertions(+), 25 deletions(-) diff --git a/cps/editbooks.py b/cps/editbooks.py index abef41ce..14d311c6 100644 --- a/cps/editbooks.py +++ b/cps/editbooks.py @@ -887,3 +887,39 @@ def convert_bookformat(book_id): else: flash(_(u"There was an error converting this book: %(res)s", res=rtn), category="error") return redirect(url_for('editbook.edit_book', book_id=book_id)) + +@editbook.route("/ajax/editbooks/", methods=['POST']) +@login_required_if_no_ano +def edit_list_book(param): + vals = request.form.to_dict() + #calibre_db.update_title_sort(config) + #calibre_db.session.connection().connection.connection.create_function('uuid4', 0, lambda: str(uuid4())) + book = calibre_db.get_book(vals['pk']) + if param =='series_index': + edit_book_series_index(vals['value'], book) + elif param =='tags': + edit_book_tags(vals['value'], book) + elif param =='series': + edit_book_series(vals['value'], book) + elif param =='publishers': + edit_book_publisher(vals['value'], book) + # ToDo: edit books + elif param =='languages': + edit_book_languages(vals['value'], book) + elif param =='title': + edit_book_languages(vals['value'], book) + elif param =='sort': + edit_book_languages(vals['value'], book) + elif param =='author_sort': + edit_book_languages(vals['value'], book) + elif param =='authors': + edit_book_languages(vals['value'], book) + + book.last_modified = datetime.utcnow() + calibre_db.session.commit() + return "" + +@editbook.route("/ajax/deletebooks") +@login_required_if_no_ano +def delete_list_book(): + pass diff --git a/cps/templates/book_table.html b/cps/templates/book_table.html index fcede828..e8150e16 100644 --- a/cps/templates/book_table.html +++ b/cps/templates/book_table.html @@ -1,4 +1,8 @@ {% extends "layout.html" %} +{% macro text_table_row(parameter, edit_text, show_text) -%} +{{ show_text }} +{%- endmacro %} + {% block header %} @@ -21,25 +25,25 @@ data-search-on-enter-key="true" data-checkbox-header="false" data-maintain-meta-data="true" + data-response-handler="responseHandler" data-editable-emptytext=""> - {% if g.user.role_edit() %} - + {% endif %} - Title - Sort - Authors Sort - Authors - Tags - Series - Series Index - Language + {{ text_table_row('title', _('Enter Title'),_('Title')) }} + {{ text_table_row('sort', _('Enter Titlesort'),_('Sort')) }} + {{ text_table_row('author_sort', _('Enter Authorsort'),_('Authors Sort')) }} + {{ text_table_row('authors', _('Enter Authors'),_('Authors')) }} + {{ text_table_row('tags', _('Enter Tags'),_('Tags')) }} + {{ text_table_row('series', _('Enter Series'),_('Series')) }} + {{_('Series Index')}} + {{ text_table_row('languages', _('Enter Languages'),_('Languages')) }} Publishing Date - Publishers + {{ text_table_row('publishers', _('Enter Publishers'),_('Publishers')) }} {% if g.user.role_edit() %} {% endif %} @@ -55,4 +59,33 @@ + {% endblock %} diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 866d11e7..8252bf4c 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -173,6 +173,7 @@ {% endif %} +