Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rat Aint Tieba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bing Chilling
Rat Aint Tieba
Commits
c92afa94
Commit
c92afa94
authored
1 year ago
by
John Xina
Browse files
Options
Downloads
Patches
Plain Diff
fix paging issue, bring back the popularity sort
parent
ac0da85e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app.py
+3
-2
3 additions, 2 deletions
app.py
templates/bar.html
+5
-6
5 additions, 6 deletions
templates/bar.html
with
8 additions
and
8 deletions
app.py
+
3
−
2
View file @
c92afa94
...
@@ -133,7 +133,7 @@ async def thread_view(tid):
...
@@ -133,7 +133,7 @@ async def thread_view(tid):
async
def
forum_view
():
async
def
forum_view
():
fname
=
request
.
args
[
'
kw
'
]
fname
=
request
.
args
[
'
kw
'
]
pn
=
int
(
request
.
args
.
get
(
'
pn
'
)
or
1
)
pn
=
int
(
request
.
args
.
get
(
'
pn
'
)
or
1
)
sort
=
int
(
request
.
args
.
get
(
'
sort
'
)
or
5
)
sort
=
int
(
request
.
args
.
get
(
'
sort
'
)
or
0
)
async
with
aiotieba
.
Client
()
as
tieba
:
async
with
aiotieba
.
Client
()
as
tieba
:
forum_info
,
threads
=
await
asyncio
.
gather
(
awaitify
(
find_tieba_info
)(
fname
),
forum_info
,
threads
=
await
asyncio
.
gather
(
awaitify
(
find_tieba_info
)(
fname
),
...
@@ -142,7 +142,8 @@ async def forum_view():
...
@@ -142,7 +142,8 @@ async def forum_view():
return
await
render_template
(
'
error.html
'
,
msg
=
\
return
await
render_template
(
'
error.html
'
,
msg
=
\
f
'
请求越界,本贴吧共有
{
threads
.
page
.
total_page
}
页
'
f
'
请求越界,本贴吧共有
{
threads
.
page
.
total_page
}
页
'
f
'
而您查询了第
{
threads
.
page
.
current_page
}
页
'
)
f
'
而您查询了第
{
threads
.
page
.
current_page
}
页
'
)
return
await
render_template
(
'
bar.html
'
,
info
=
forum_info
,
threads
=
threads
,
sort
=
sort
)
return
await
render_template
(
'
bar.html
'
,
info
=
forum_info
,
threads
=
threads
,
sort
=
sort
,
tp
=
((
115
if
threads
.
page
.
total_page
>
115
else
threads
.
page
.
total_page
)
if
sort
==
0
else
threads
.
page
.
total_page
))
@app.route
(
'
/home/main
'
)
@app.route
(
'
/home/main
'
)
async
def
user_view
():
async
def
user_view
():
...
...
This diff is collapsed.
Click to expand it.
templates/bar.html
+
5
−
6
View file @
c92afa94
...
@@ -23,9 +23,8 @@
...
@@ -23,9 +23,8 @@
</header>
</header>
<div
class=
"list"
>
<div
class=
"list"
>
<div
class=
"vlist"
>
<div
class=
"vlist"
>
<!-- POPULAR SORT IS UNAVAILABLE -->
<div><a
{%
if
sort =
=
0
%}
class=
"current-sel"
{%
endif
%}
<!-- <div><a {% if sort == 0 %} class="current-sel" {% endif %}
href=
"/f?kw={{ info['name'] }}&pn={{ threads.page.current_page }}&sort=0"
>
时下热门
</a></div>
href="/f?kw={{ info['name'] }}&pn={{ threads.page.current_page }}&sort=0">时下热门</a></div> -->
<div><a
{%
if
sort =
=
5
%}
class=
"current-sel"
{%
endif
%}
<div><a
{%
if
sort =
=
5
%}
class=
"current-sel"
{%
endif
%}
href=
"/f?kw={{ info['name'] }}&sort=5"
>
最新回复
</a></div>
href=
"/f?kw={{ info['name'] }}&sort=5"
>
最新回复
</a></div>
<div><a
{%
if
sort =
=
1
%}
class=
"current-sel"
{%
endif
%}
<div><a
{%
if
sort =
=
1
%}
class=
"current-sel"
{%
endif
%}
...
@@ -75,13 +74,13 @@
...
@@ -75,13 +74,13 @@
{% for i in range(5) %}
{% for i in range(5) %}
{% set np = threads.page.current_page + 1 + i %}
{% set np = threads.page.current_page + 1 + i %}
{% if np
<
=
t
hreads.page.total_page
%}
{% if np
<
=
t
p
%}
<
a
href=
"/f?kw={{ info['name'] }}&pn={{ np }}&sort={{ sort }}"
>
{{ np }}
</a>
<
a
href=
"/f?kw={{ info['name'] }}&pn={{ np }}&sort={{ sort }}"
>
{{ np }}
</a>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% if threads.page.current_page
<
t
hreads.page.total_page
%}
{% if threads.page.current_page
<
t
p
%}
<
a
href=
"/f?kw={{ info['name'] }}&pn={{ t
hreads.page.total_page
}}&sort={{ sort }}"
>
尾页
</a>
<
a
href=
"/f?kw={{ info['name'] }}&pn={{ t
p
}}&sort={{ sort }}"
>
尾页
</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment