From 0414bb0816457a3352e113b340562be04e10dc9b Mon Sep 17 00:00:00 2001 From: Tdxdxoz Date: Sat, 26 Dec 2020 15:30:44 +0800 Subject: [PATCH] feat: better UI, prepare for download count --- app.py | 9 ++++--- templates/list.html | 59 +++++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/app.py b/app.py index 050219a..c40e532 100644 --- a/app.py +++ b/app.py @@ -46,8 +46,11 @@ def list(): teacher = request.args.get('teacher') year = request.args.get('year') year = year and year.isdigit() and int(year) - has_year = year or year == 0 - ept = not (course or teacher or has_year) + + has_course = course is not None + has_teacher = teacher is not None + has_year = year is not None + ept = not (has_course or has_teacher or has_year) ps = Paper.query @@ -55,7 +58,7 @@ def list(): ps = ps.filter_by(course=course) if teacher: ps = ps.filter_by(teacher=teacher) - if has_year: + if year or year==0: ps = ps.filter_by(year=year) ps = ps.order_by(db.desc('like_num')) diff --git a/templates/list.html b/templates/list.html index c44c678..c948cd2 100644 --- a/templates/list.html +++ b/templates/list.html @@ -115,10 +115,6 @@ border-color: #495057; } - .qbox .inner { - margin: 15px 0 20px 15px; - } - .like { fill: #fff; } @@ -215,7 +211,7 @@ -

勾选匿名发布后,其他人在查看时作者会显示为“匿名”。

+

开启匿名发布后,其他人在查看时作者会显示为“匿名”。

@@ -228,7 +224,7 @@
-
+
@@ -238,7 +234,7 @@
-
+
-
+
{% for t in all_teachers %} {{t}} @@ -271,14 +267,17 @@
-
- {% for y in all_years %} - {{y or '/'}} - {% endfor %} +
+ {% for y in all_years %} + {{y or '/'}} + {% endfor %} +
+
+
+
+
+

点击某一课程/教师/年份进行筛选

-
-
-
{% for p in pagination.items %} @@ -291,26 +290,18 @@ {% endif %} -

- {{p.course}} - {{p.teacher}} - {{p.year or '/'}} - 查看 +

{{p.course}}
+

+ {{p.teacher}} - {{p.year or '/'}}

-

{{p.notes}}

-
+
{{p.notes}}
+
@{{'匿名用户' if p.anon else p.author}} | {{p.create_date}} - - - - - - {{p.like_num}} - + + 有用({{p.like_num}}) + + + 下载({{p.like_num}})
@@ -351,7 +342,7 @@