From ad3c3c13b1ce8dd69ed847160081a79937a5a699 Mon Sep 17 00:00:00 2001 From: CodeKevin Date: Fri, 5 Feb 2016 20:59:47 -0500 Subject: [PATCH] Improved pagination and renaming main-style.css --- CTFd/admin.py | 2 +- CTFd/static/css/{main-style.css => style.css} | 0 CTFd/templates/admin/base.html | 2 +- CTFd/templates/admin/teams.html | 9 +++++++-- CTFd/templates/base.html | 2 +- CTFd/templates/teams.html | 2 ++ 6 files changed, 12 insertions(+), 5 deletions(-) rename CTFd/static/css/{main-style.css => style.css} (100%) diff --git a/CTFd/admin.py b/CTFd/admin.py index 2d43446..504f232 100644 --- a/CTFd/admin.py +++ b/CTFd/admin.py @@ -332,7 +332,7 @@ def admin_teams(page): teams = Teams.query.slice(page_start, page_end).all() count = db.session.query(db.func.count(Teams.id)).first()[0] pages = int(count / results_per_page) + (count % results_per_page > 0) - return render_template('admin/teams.html', teams=teams, pages=pages) + return render_template('admin/teams.html', teams=teams, pages=pages, curr_page=page) @admin.route('/admin/team/', methods=['GET', 'POST']) diff --git a/CTFd/static/css/main-style.css b/CTFd/static/css/style.css similarity index 100% rename from CTFd/static/css/main-style.css rename to CTFd/static/css/style.css diff --git a/CTFd/templates/admin/base.html b/CTFd/templates/admin/base.html index 2a82c5b..8a79887 100644 --- a/CTFd/templates/admin/base.html +++ b/CTFd/templates/admin/base.html @@ -8,7 +8,7 @@ - + diff --git a/CTFd/templates/admin/teams.html b/CTFd/templates/admin/teams.html index 19601e7..fc543b6 100644 --- a/CTFd/templates/admin/teams.html +++ b/CTFd/templates/admin/teams.html @@ -149,10 +149,15 @@ input[type="checkbox"] { margin: 0px !important; position: relative; top: 5px; } {% if pages > 1 %}
Page
+ {% if curr_page != 1 %}<<<{% endif %} {% for page in range(1, pages + 1) %} - {{ page }} + {% if curr_page != page %} + {{ page }} + {% else %} + {{ page }} + {% endif %} {% endfor %} - + {% if curr_page != pages %}>>>{% endif %}
{% endif %} diff --git a/CTFd/templates/base.html b/CTFd/templates/base.html index c34bca7..604d13c 100644 --- a/CTFd/templates/base.html +++ b/CTFd/templates/base.html @@ -7,7 +7,7 @@ - + diff --git a/CTFd/templates/teams.html b/CTFd/templates/teams.html index a2f50c8..377b55a 100644 --- a/CTFd/templates/teams.html +++ b/CTFd/templates/teams.html @@ -34,6 +34,7 @@ {% if team_pages > 1 %}
Page
+ {% if curr_page != 1 %}<<<{% endif %} {% for page in range(1, team_pages + 1) %} {% if curr_page != page %} {{ page }} @@ -41,6 +42,7 @@ {{page}} {% endif %} {% endfor %} + {% if curr_page != pages %}>>>{% endif %}
{% endif %}