Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
69b7d947
Commit
69b7d947
authored
Feb 06, 2021
by
alfred82santa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes and remove shelf kobo sync flag when kobo sync disabled
parent
8fe76270
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
shelf.py
cps/shelf.py
+7
-5
shelf_edit.html
cps/templates/shelf_edit.html
+6
-3
ub.py
cps/ub.py
+1
-0
No files found.
cps/shelf.py
View file @
69b7d947
...
...
@@ -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
):
...
...
cps/templates/shelf_edit.html
View file @
69b7d947
...
...
@@ -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>
...
...
cps/ub.py
View file @
69b7d947
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment