1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 12:30:00 +00:00

Changed texts in edit shelf page for Kobo shelf sync

This commit is contained in:
Ozzieisaacs 2021-05-02 15:59:40 +02:00
parent 02fc698f1c
commit eb2273247f
2 changed files with 8 additions and 3 deletions

View File

@ -240,6 +240,8 @@ def edit_shelf(shelf_id):
# if shelf ID is set, we are editing a shelf # if shelf ID is set, we are editing a shelf
def create_edit_shelf(shelf, title, page, shelf_id=False): def create_edit_shelf(shelf, title, page, shelf_id=False):
sync_all_books = calibre_db.session.query(ub.Shelf).filter(ub.Shelf.user_id == current_user.id)\
.filter(ub.Shelf.kobo_sync).count()
if request.method == "POST": if request.method == "POST":
to_save = request.form.to_dict() to_save = request.form.to_dict()
shelf.is_public = 1 if to_save.get("is_public") else 0 shelf.is_public = 1 if to_save.get("is_public") else 0
@ -248,7 +250,6 @@ def create_edit_shelf(shelf, title, page, shelf_id=False):
if check_shelf_is_unique(shelf, to_save, shelf_id): if check_shelf_is_unique(shelf, to_save, shelf_id):
shelf.name = to_save["title"] shelf.name = to_save["title"]
# shelf.last_modified = datetime.utcnow()
if not shelf_id: if not shelf_id:
shelf.user_id = int(current_user.id) shelf.user_id = int(current_user.id)
ub.session.add(shelf) ub.session.add(shelf)
@ -275,7 +276,8 @@ def create_edit_shelf(shelf, title, page, shelf_id=False):
shelf=shelf, shelf=shelf,
title=title, title=title,
page=page, page=page,
kobo_sync_enabled=config.config_kobo_sync) kobo_sync_enabled=config.config_kobo_sync,
sync_all_books=sync_all_books)
def check_shelf_is_unique(shelf, to_save, shelf_id=False): def check_shelf_is_unique(shelf, to_save, shelf_id=False):

View File

@ -18,7 +18,10 @@
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="kobo_sync" <input type="checkbox" name="kobo_sync"
{% if shelf.kobo_sync == 1 %}checked{% endif %}> {{ _('Synchronize with Kobo device') }} {% if shelf.kobo_sync == 1 %}checked{% endif %}>
{% if shelf.kobo_sync == 1 and sync_all_books == 1 %}{{ _('Sync with Kobo device - If this option is turned off, all books and shelves will be synced with Kobo') }}
{% elif sync_all_books == 0 and shelf.kobo_sync == 0 %}{{ _('Only sync books from selected shelves to Kobo instead of all books and shelves') }}
{% else %}{{ _('Sync with Kobo device') }}{% endif %}
</label> </label>
</div> </div>
{% endif %} {% endif %}