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
ab24ed80
Commit
ab24ed80
authored
Feb 09, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle sorting of hidden books #1123
Prevent downloading of covers from hidden books
parent
50ba2e32
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
helper.py
cps/helper.py
+1
-1
shelf.py
cps/shelf.py
+17
-6
shelf_order.html
cps/templates/shelf_order.html
+6
-6
No files found.
cps/helper.py
View file @
ab24ed80
...
...
@@ -455,7 +455,7 @@ def get_cover_on_failure(use_generic_cover):
return
None
def
get_book_cover
(
book_id
):
book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book_id
)
.
first
()
book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book_id
)
.
fi
lter
(
common_filters
())
.
fi
rst
()
return
get_book_cover_internal
(
book
,
use_generic_cover_on_failure
=
True
)
def
get_book_cover_with_uuid
(
book_uuid
,
...
...
cps/shelf.py
View file @
ab24ed80
...
...
@@ -291,9 +291,11 @@ def show_shelf(shelf_type, shelf_id):
if
cur_book
:
result
.
append
(
cur_book
)
else
:
log
.
info
(
'Not existing book
%
s in
%
s deleted'
,
book
.
book_id
,
shelf
)
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
book_id
==
book
.
book_id
)
.
delete
()
ub
.
session
.
commit
()
cur_book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book
.
book_id
)
.
first
()
if
not
cur_book
:
log
.
info
(
'Not existing book
%
s in
%
s deleted'
,
book
.
book_id
,
shelf
)
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
book_id
==
book
.
book_id
)
.
delete
()
ub
.
session
.
commit
()
return
render_title_template
(
page
,
entries
=
result
,
title
=
_
(
u"Shelf: '
%(name)
s'"
,
name
=
shelf
.
name
),
shelf
=
shelf
,
page
=
"shelf"
)
else
:
...
...
@@ -327,9 +329,18 @@ def order_shelf(shelf_id):
.
order_by
(
ub
.
BookShelf
.
order
.
asc
())
.
all
()
for
book
in
books_in_shelf2
:
cur_book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book
.
book_id
)
.
filter
(
common_filters
())
.
first
()
result
.
append
(
cur_book
)
#books_list = [ b.book_id for b in books_in_shelf2]
#result = db.session.query(db.Books).filter(db.Books.id.in_(books_list)).filter(common_filters()).all()
if
cur_book
:
result
.
append
({
'title'
:
cur_book
.
title
,
'id'
:
cur_book
.
id
,
'author'
:
cur_book
.
authors
,
'series'
:
cur_book
.
series
,
'series_index'
:
cur_book
.
series_index
})
else
:
cur_book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book
.
book_id
)
.
first
()
result
.
append
({
'title'
:
_
(
'Hidden Book'
),
'id'
:
cur_book
.
id
,
'author'
:[],
'series'
:[]})
return
render_title_template
(
'shelf_order.html'
,
entries
=
result
,
title
=
_
(
u"Change order of Shelf: '
%(name)
s'"
,
name
=
shelf
.
name
),
shelf
=
shelf
,
page
=
"shelforder"
)
cps/templates/shelf_order.html
View file @
ab24ed80
...
...
@@ -5,19 +5,19 @@
<div>
{{_('Drag \'n drop to rearrange order')}}
</div>
<div
id=
"sortTrue"
class=
"list-group"
>
{% for entry in entries %}
<div
id=
"{{entry
.id
}}"
class=
"list-group-item"
>
<div
id=
"{{entry
['id']
}}"
class=
"list-group-item"
>
<div
class=
"row"
>
<div
class=
"col-lg-2 col-sm-4 hidden-xs"
>
<img
class=
"cover-height"
src=
"{{ url_for('web.get_cover', book_id=entry
.id
) }}"
>
<img
class=
"cover-height"
src=
"{{ url_for('web.get_cover', book_id=entry
['id']
) }}"
>
</div>
<div
class=
"col-lg-10 col-sm-8 col-xs-12"
>
{{entry
.title
}}
{% if entry
.series
|length > 0 %}
{{entry
['title']
}}
{% if entry
['series']
|length > 0 %}
<br>
{{entry
.series_index}} - {{entry.series
[0].name}}
{{entry
['series_index']}} - {{entry['series']
[0].name}}
{% endif %}
<br>
{% for author in entry
.authors
%}
{% for author in entry
['authors']
%}
{{author.name.replace('|',',')}}
{% if not loop.last %}
&
...
...
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