Skip to content

Commit

Permalink
Use has_other_pages() to check if the pagination bar should be shown (
Browse files Browse the repository at this point in the history
DMOJ#1446)

...rather than the number of pages since the infinite paginator
returns a constant 1e3000 even if there is only 1 page.
  • Loading branch information
Ninjaclasher authored and outloudvi committed Sep 28, 2020
1 parent 5fb8b1a commit 0ae29d1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion templates/blog/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h2 class="ui header">
</section>
{% endfor %}
</div>
{% if page_obj.num_pages > 1 %}
{% if page_obj.has_other_pages() %}
{% include "list-pages.html" %}
{% endif %}
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/contest/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ <h4>{{ _('Upcoming Contests') }}</h4>

{% if past_contests %}
<h4>{{ _('Past Contests') }}</h4>
{% if page_obj and page_obj.num_pages > 1 %}
{% if page_obj and page_obj.has_other_pages() %}
<div style="margin-bottom: 4px;">
{% include "list-pages.html" %}
</div>
Expand Down Expand Up @@ -277,7 +277,7 @@ <h4>{{ _('Past Contests') }}</h4>
{% endfor %}
</tbody>
</table>
{% if page_obj and page_obj.num_pages > 1 %}
{% if page_obj and page_obj.has_other_pages() %}
<div style="margin-top: 10px;">
{% include "list-pages.html" %}
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/problem/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
{% endblock %}

{% block body %}
{% if page_obj.num_pages > 1 %}
{% if page_obj.has_other_pages() %}
<div style="margin-bottom: 7px; margin-top: 11px;">
{% include "list-pages.html" %}
</div>
Expand Down Expand Up @@ -268,7 +268,7 @@
{% endfor %}
</tbody>
</table>
{% if page_obj.num_pages > 1 %}
{% if page_obj.has_other_pages() %}
{% include "list-pages.html" %}
{% endif %}
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/submission/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
{% endblock %}

{% block body %}
{% if page_obj.num_pages > 1 %}
{% if page_obj.has_other_pages() %}
<div style="margin-bottom: 6px; margin-top: 11px">
{% include "list-pages.html" %}
</div>
Expand All @@ -317,7 +317,7 @@
{% endfor %}
</tbody>
</table>
{% if page_obj.num_pages > 1 %}
{% if page_obj.has_other_pages() %}
<div style="margin-top:10px;">{% include "list-pages.html" %}</div>
{% endif %}
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/ticket/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
</aside>

<main>
{% if page_obj.num_pages > 1 %}
{% if page_obj.has_other_pages() %}
{% include "list-pages.html" %}
{% endif %}
<div class="h-scrollable-table">
Expand All @@ -273,7 +273,7 @@
</tbody>
</table>
</div>
{% if page_obj.num_pages > 1 %}
{% if page_obj.has_other_pages() %}
{% include "list-pages.html" %}
{% endif %}
</main>
Expand Down
4 changes: 2 additions & 2 deletions templates/user/base-users.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{% block body %}
<div id="common-content">
<div id="content-left" class="users">
{% if page_obj and page_obj.num_pages > 1 %}
{% if page_obj and page_obj.has_other_pages() %}
<div class="user-pagination">
{% include "list-pages.html" %}
<form id="search-form" name="form" action="{{ url('user_ranking_redirect') }}" method="get">
Expand All @@ -87,7 +87,7 @@
</table>
</div>

{% if page_obj and page_obj.num_pages > 1 %}
{% if page_obj and page_obj.has_other_pages() %}
{% include "list-pages.html" %}
{% endif %}
</div>
Expand Down

0 comments on commit 0ae29d1

Please # to comment.