mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Fixes and remove shelf kobo sync flag when kobo sync disabled
This commit is contained in:
parent
8fe762709b
commit
69b7d94774
12
cps/shelf.py
12
cps/shelf.py
@ -30,7 +30,7 @@ from flask_login import login_required, current_user
|
||||
from sqlalchemy.sql.expression import func, true
|
||||
from sqlalchemy.exc import OperationalError, InvalidRequestError
|
||||
|
||||
from . import logger, ub, calibre_db, db
|
||||
from . import logger, ub, calibre_db, db, config
|
||||
from .render_template import render_title_template
|
||||
from .usermanagement import login_required_if_no_ano
|
||||
|
||||
@ -240,10 +240,8 @@ def create_edit_shelf(shelf, title, page, shelf_id=False):
|
||||
else:
|
||||
shelf.is_public = 0
|
||||
|
||||
if "kobo_sync" in to_save:
|
||||
if config.config_kobo_sync and "kobo_sync" in to_save:
|
||||
shelf.kobo_sync = True
|
||||
else:
|
||||
shelf.kobo_sync = False
|
||||
|
||||
if check_shelf_is_unique(shelf, to_save, shelf_id):
|
||||
shelf.name = to_save["title"]
|
||||
@ -269,7 +267,11 @@ def create_edit_shelf(shelf, title, page, shelf_id=False):
|
||||
ub.session.rollback()
|
||||
log.debug_or_exception(e)
|
||||
flash(_(u"There was an error"), category="error")
|
||||
return render_title_template('shelf_edit.html', shelf=shelf, title=title, page=page)
|
||||
return render_title_template('shelf_edit.html',
|
||||
shelf=shelf,
|
||||
title=title,
|
||||
page=page,
|
||||
kobo_sync_enabled=config.config_kobo_sync)
|
||||
|
||||
|
||||
def check_shelf_is_unique(shelf, to_save, shelf_id=False):
|
||||
|
@ -13,10 +13,13 @@
|
||||
<input type="checkbox" name="is_public" {% if shelf.is_public == 1 %}checked{% endif %}> {{_('Share with Everyone')}}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if kobo_sync_enabled %}
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="kobo_sync" {% if shelf.kobo_sync == 1 %}checked{% endif %}> {{_('Synchronize with Kobo device')}}
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="kobo_sync"
|
||||
{% if shelf.kobo_sync == 1 %}checked{% endif %}> {{ _('Synchronize with Kobo device') }}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button type="submit" class="btn btn-default" id="submit">{{_('Save')}}</button>
|
||||
|
@ -498,6 +498,7 @@ def migrate_Database(session):
|
||||
conn.execute("ALTER TABLE shelf ADD column 'created' DATETIME")
|
||||
conn.execute("ALTER TABLE shelf ADD column 'last_modified' DATETIME")
|
||||
conn.execute("ALTER TABLE book_shelf_link ADD column 'date_added' DATETIME")
|
||||
conn.execute("ALTER TABLE shelf ADD column 'kobo_sync' BOOLEAN DEFAULT false")
|
||||
for shelf in session.query(Shelf).all():
|
||||
shelf.uuid = str(uuid.uuid4())
|
||||
shelf.created = datetime.datetime.now()
|
||||
|
Loading…
Reference in New Issue
Block a user