diff options
author | 2019-04-19 11:36:40 +0100 | |
---|---|---|
committer | 2019-04-19 11:36:40 +0100 | |
commit | 5e76c9ade203830c7f9a904d049dd54299a215b1 (patch) | |
tree | 6c530ba0a639b5f8859f4716778e076f9fb4dc28 /pydis_site/templates | |
parent | Searching and pagination (diff) |
Big pagination changes because the wiki is stupid
Diffstat (limited to 'pydis_site/templates')
-rw-r--r-- | pydis_site/templates/base/paginator.html | 41 | ||||
-rw-r--r-- | pydis_site/templates/wiki/history.html | 4 |
2 files changed, 24 insertions, 21 deletions
diff --git a/pydis_site/templates/base/paginator.html b/pydis_site/templates/base/paginator.html index 8eaa37ee..9cf031f0 100644 --- a/pydis_site/templates/base/paginator.html +++ b/pydis_site/templates/base/paginator.html @@ -1,27 +1,28 @@ +{% load extra_tags %} {% comment %} This template inserts a Bulma paginator wherever one is required. Simply include it as follows: -{% include "base/paginator.html" with page=paginator_object %} +{% include "base/paginator.html" with page_obj=paginator_object %} {% endcomment %} <nav class="pagination" role="navigation" aria-label="pagination"> - {% if page.has_previous %} - <a class="pagination-previous" href="{% url "blog.posts" page=page.previous_page_number %}">Newer</a> + {% if page_obj.has_previous %} + <a class="pagination-previous" href="{% url_extend page=page_obj.previous_page_number %}">Newer</a> {% else %} <a class="pagination-previous" title="This is the first page" disabled>Newer</a> {% endif %} - {% if page.has_next %} - <a class="pagination-next" href="{% url "" page=1 %}">Older</a> + {% if page_obj.has_next %} + <a class="pagination-next" href="{% url_extend page=1 %}">Older</a> {% else %} <a class="pagination-next" title="This is the last page" disabled>Older</a> {% endif %} <ul class="pagination-list"> - {% if page.has_previous %} + {% if page_obj.has_previous %} <li> <a class="pagination-link" aria-label="Goto page 1" - href="{% url "blog.posts" page=1 %}"> + href="{% url_extend page=1 %}"> 1 </a> </li> @@ -29,34 +30,34 @@ This template inserts a Bulma paginator wherever one is required. Simply include <span class="pagination-ellipsis">…</span> </li> <li> - <a class="pagination-link" aria-label="Goto page {{ page.previous_page_number }}" - href="{% url "blog.posts" page=page.previous_page_number %}"> - {{ page.previous_page_number }} + <a class="pagination-link" aria-label="Goto page {{ page_obj.previous_page_number }}" + href="{% url_extend page=page_obj.previous_page_number %}"> + {{ page_obj.previous_page_number }} </a> </li> {% endif %} <li> - <a class="pagination-link is-current" aria-label="Page {{ page.number }}" aria-current="page" - href="{% url "blog.posts" page=page.number %}"> - {{ page.number }} + <a class="pagination-link is-current" aria-label="Page {{ page_obj.number }}" aria-current="page" + href="{% url_extend page=page_obj.number %}"> + {{ page_obj.number }} </a> </li> - {% if page.has_next %} + {% if page_obj.has_next %} <li> - <a class="pagination-link" aria-label="Goto page {{ page.next_page_number }}" - href="{% url "blog.posts" page=page.next_page_number %}"> - {{ page.next_page_number }} + <a class="pagination-link" aria-label="Goto page {{ page_obj.next_page_number }}" + href="{% url_extend page=page_obj.next_page_number %}"> + {{ page_obj.next_page_number }} </a> </li> <li> <span class="pagination-ellipsis">…</span> </li> <li> - <a class="pagination-link" aria-label="Goto page {{ page.paginator.num_pages }}" - href="{% url "blog.posts" page=page.paginator.num_pages %}"> - {{ page.paginator.num_pages }} + <a class="pagination-link" aria-label="Goto page {{ page_obj.paginator.num_pages }}" + href="{% url_extend page=page_obj.paginator.num_pages %}"> + {{ page_obj.paginator.num_pages }} </a> </li> {% endif %} diff --git a/pydis_site/templates/wiki/history.html b/pydis_site/templates/wiki/history.html index d0a0d868..afc6eafe 100644 --- a/pydis_site/templates/wiki/history.html +++ b/pydis_site/templates/wiki/history.html @@ -118,8 +118,10 @@ </div> {% endfor %} + {% include "wiki/includes/pagination.html" %} + {% if is_paginated %} - {% include "base/paginator.html" with page=page_obj %} + {% include "base/paginator.html" %} {% endif %} {% if revisions.count > 1 and article|can_write:user and not article.current_revision.locked %} |