mirror of https://github.com/JohnHammond/CTFd.git
Adding better pagination for wrong/right key pages
parent
46413ba6ae
commit
0c9a4f0283
|
@ -546,7 +546,7 @@ def admin_wrong_key(page='1'):
|
||||||
wrong_count = db.session.query(db.func.count(WrongKeys.id)).first()[0]
|
wrong_count = db.session.query(db.func.count(WrongKeys.id)).first()[0]
|
||||||
pages = int(wrong_count / results_per_page) + (wrong_count % results_per_page > 0)
|
pages = int(wrong_count / results_per_page) + (wrong_count % results_per_page > 0)
|
||||||
|
|
||||||
return render_template('admin/wrong_keys.html', wrong_keys=wrong_keys, pages=pages)
|
return render_template('admin/wrong_keys.html', wrong_keys=wrong_keys, pages=pages, curr_page=page)
|
||||||
|
|
||||||
|
|
||||||
@admin.route('/admin/correct_keys/<page>', methods=['GET'])
|
@admin.route('/admin/correct_keys/<page>', methods=['GET'])
|
||||||
|
@ -564,7 +564,7 @@ def admin_correct_key(page='1'):
|
||||||
solve_count = db.session.query(db.func.count(Solves.id)).first()[0]
|
solve_count = db.session.query(db.func.count(Solves.id)).first()[0]
|
||||||
pages = int(solve_count / results_per_page) + (solve_count % results_per_page > 0)
|
pages = int(solve_count / results_per_page) + (solve_count % results_per_page > 0)
|
||||||
|
|
||||||
return render_template('admin/correct_keys.html', solves=solves, pages=pages)
|
return render_template('admin/correct_keys.html', solves=solves, pages=pages, curr_page=page)
|
||||||
|
|
||||||
|
|
||||||
@admin.route('/admin/fails/<teamid>', methods=['GET'])
|
@admin.route('/admin/fails/<teamid>', methods=['GET'])
|
||||||
|
|
|
@ -60,9 +60,15 @@
|
||||||
{% if pages > 1 %}
|
{% if pages > 1 %}
|
||||||
<div class="text-center">Page
|
<div class="text-center">Page
|
||||||
<br>
|
<br>
|
||||||
|
{% if curr_page != 1 %}<a href="/admin/correct_keys/{{ curr_page-1 }}"><<<</a>{% endif %}
|
||||||
{% for page in range(1, pages + 1) %}
|
{% for page in range(1, pages + 1) %}
|
||||||
<a href="{{ page }}">{{ page }}</a>
|
{% if curr_page != page %}
|
||||||
|
<a href="/admin/wrong_keys/{{ page }}">{{ page }}</a>
|
||||||
|
{% else %}
|
||||||
|
<b>{{ page }}</b>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if curr_page != pages %}<a href="/admin/correct_keys/{{ curr_page+1 }}">>>></a>{% endif %}
|
||||||
<a href="">
|
<a href="">
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -67,9 +67,15 @@
|
||||||
{% if pages > 1 %}
|
{% if pages > 1 %}
|
||||||
<div class="text-center">Page
|
<div class="text-center">Page
|
||||||
<br>
|
<br>
|
||||||
|
{% if curr_page != 1 %}<a href="/admin/wrong_keys/{{ curr_page-1 }}"><<<</a>{% endif %}
|
||||||
{% for page in range(1, pages + 1) %}
|
{% for page in range(1, pages + 1) %}
|
||||||
<a href="{{ page }}">{{ page }}</a>
|
{% if curr_page != page %}
|
||||||
|
<a href="/admin/wrong_keys/{{ page }}">{{ page }}</a>
|
||||||
|
{% else %}
|
||||||
|
<b>{{ page }}</b>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if curr_page != pages %}<a href="/admin/wrong_keys/{{ curr_page+1 }}">>>></a>{% endif %}
|
||||||
<a href="">
|
<a href="">
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue