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
c403fdfa
Commit
c403fdfa
authored
Jul 23, 2017
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'adv/sorting'
parents
97d577ef
7631eea3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
2 deletions
+50
-2
layout.html
cps/templates/layout.html
+13
-1
web.py
cps/web.py
+37
-1
No files found.
cps/templates/layout.html
View file @
c403fdfa
...
...
@@ -121,7 +121,19 @@
<nav
class=
"navigation"
>
<ul
class=
"list-unstyled"
id=
"scnd-nav"
intent
in-standard-append=
"nav.navigation"
in-mobile-after=
"#main-nav"
in-mobile-class=
"nav navbar-nav"
>
<li
class=
"nav-head hidden-xs"
>
{{_('Browse')}}
</li>
<li
id=
"nav_new"
><a
href=
"{{url_for('index')}}"
><span
class=
"glyphicon glyphicon-book"
></span>
{{_('New Books')}}
</a></li>
<li
id=
"nav_new"
><a
href=
"{{url_for('index')}}"
><span
class=
"glyphicon glyphicon-book"
></span>
{{_('Recently Added')}}
</a></li>
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
role=
"button"
aria-haspopup=
"true"
aria-expanded=
"false"
>
<span
class=
"glyphicon glyphicon-sort-by-attributes"
></span>
{{_('Sorted Books')}}
<span
class=
"caret"
></span>
</a>
<ul
class=
"dropdown-menu"
>
<li><a
href=
"{{url_for('newest_books')}}"
>
{{_('Sort By')}} {{_('Newest')}}
</a></li>
<li><a
href=
"{{url_for('oldest_books')}}"
>
{{_('Sort By')}} {{_('Oldest')}}
</a></li>
<li><a
href=
"{{url_for('titles_ascending')}}"
>
{{_('Sort By')}} {{_('Title')}} ({{_('Ascending')}})
</a></li>
<li><a
href=
"{{url_for('titles_descending')}}"
>
{{_('Sort By')}} {{_('Title')}} ({{_('Descending')}})
</a></li>
</ul>
</li>
{% if g.user.show_hot_books() %}
<li
id=
"nav_hot"
><a
href=
"{{url_for('hot_books')}}"
><span
class=
"glyphicon glyphicon-fire"
></span>
{{_('Hot Books')}}
</a></li>
{%endif%}
...
...
cps/web.py
View file @
c403fdfa
...
...
@@ -1009,7 +1009,43 @@ def get_matching_tags():
def
index
(
page
):
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
db
.
Books
.
timestamp
.
desc
())
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Latest Books"
))
title
=
_
(
u"Recently Added Books"
))
@
app
.
route
(
'/books/newest'
,
defaults
=
{
'page'
:
1
})
@
app
.
route
(
'/books/newest/page/<int:page>'
)
@
login_required_if_no_ano
def
newest_books
(
page
):
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
db
.
Books
.
pubdate
.
desc
())
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Newest Books"
))
@
app
.
route
(
'/books/oldest'
,
defaults
=
{
'page'
:
1
})
@
app
.
route
(
'/books/oldest/page/<int:page>'
)
@
login_required_if_no_ano
def
oldest_books
(
page
):
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
db
.
Books
.
pubdate
)
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Oldest Books"
))
@
app
.
route
(
'/books/a-z'
,
defaults
=
{
'page'
:
1
})
@
app
.
route
(
'/books/a-z/page/<int:page>'
)
@
login_required_if_no_ano
def
titles_ascending
(
page
):
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
db
.
Books
.
sort
)
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Books (A-Z)"
))
@
app
.
route
(
'/books/z-a'
,
defaults
=
{
'page'
:
1
})
@
app
.
route
(
'/books/z-a/page/<int:page>'
)
@
login_required_if_no_ano
def
titles_descending
(
page
):
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
db
.
Books
.
sort
.
desc
())
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Books (Z-A)"
))
@
app
.
route
(
"/hot"
,
defaults
=
{
'page'
:
1
})
...
...
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