-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring template and using bootstrap pagination style.
- Loading branch information
1 parent
4418e54
commit f78a4be
Showing
6 changed files
with
76 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
nikola/data/themes/base-jinja/templates/pagination_helper.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
{% macro page_navigation(current_page, page_links, prevlink, nextlink) %} | ||
<div class="page-navigation"> | ||
{% for i, link in enumerate(page_links) %} | ||
{% if abs(i - current_page) <= 3 or i == 0 or i == page_links|length - 1 %} | ||
{% if i == current_page %} | ||
<span class="current-page">{{ i+1 }}</span> | ||
{% else %} | ||
<a href="{{ page_links[i] }}">{{ i+1 }}</a> | ||
{% endif %} | ||
{% elif i == current_page - 4 or i == current_page + 4 %} | ||
<span class="ellipsis">⋯</span> | ||
{% endif %} | ||
{% endfor %} | ||
</div> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## -*- coding: utf-8 -*- | ||
<%def name="page_navigation(current_page, page_links, prevlink, nextlink)"> | ||
<div class="page-navigation"> | ||
% for i, link in enumerate(page_links): | ||
% if abs(i - current_page) <= 3 or i == 0 or i == len(page_links) - 1: | ||
% if i == current_page: | ||
<span class="current-page">${i+1}</span> | ||
% else: | ||
<a href="${page_links[i]}">${i+1}</a> | ||
% endif | ||
% elif i == current_page - 4 or i == current_page + 4: | ||
<span class="ellipsis">⋯</span> | ||
% endif | ||
% endfor | ||
</div> | ||
</%def> |
20 changes: 20 additions & 0 deletions
20
nikola/data/themes/bootstrap3-jinja/templates/pagination_helper.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{# -*- coding: utf-8 -*- #} | ||
{% macro page_navigation(current_page, page_links, prevlink, nextlink) %} | ||
<nav aria-label="Page navigation"> | ||
<ul class="pagination"> | ||
{% if prevlink %} | ||
<li><a href="{{ prevlink }}" aria-label="{{ messages("Newer posts") }}"><span aria-hidden="true">«</span></a></li> | ||
{% else %} | ||
<li class="disabled"><a href="#" aria-label="{{ messages("Newer posts") }}"><span aria-hidden="true">«</span></a></li> | ||
{% endif %} | ||
{% for i, link in enumerate(page_links) %} | ||
<li {{ ' class="active"' if i == current_page else '' }}><a href="{{ link }}">{{ i + 1 }}{{ ' <span class="sr-only">(current)</span>' if i == current_page else '' }}</a></li> | ||
{% endfor %} | ||
{% if nextlink %} | ||
<li><a href="{{ nextlink }}" aria-label="{{ messages("Older posts") }}"><span aria-hidden="true">»</span></a></li> | ||
{% else %} | ||
<li class="disabled"><a href="#" aria-label="{{ messages("Older posts") }}"><span aria-hidden="true">»</span></a></li> | ||
{% endif %} | ||
</ul> | ||
</nav> | ||
{% endmacro %} |
20 changes: 20 additions & 0 deletions
20
nikola/data/themes/bootstrap3/templates/pagination_helper.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## -*- coding: utf-8 -*- | ||
<%def name="page_navigation(current_page, page_links, prevlink, nextlink)"> | ||
<nav aria-label="Page navigation"> | ||
<ul class="pagination"> | ||
% if prevlink: | ||
<li><a href="${prevlink}" aria-label="${messages("Newer posts")}"><span aria-hidden="true">«</span></a></li> | ||
% else: | ||
<li class="disabled"><a href="#" aria-label="${messages("Newer posts")}"><span aria-hidden="true">«</span></a></li> | ||
% endif | ||
% for i, link in enumerate(page_links): | ||
<li ${' class="active"' if i == current_page else ''}><a href="${link}">${i + 1}${' <span class="sr-only">(current)</span>' if i == current_page else ''}</a></li> | ||
% endfor | ||
% if nextlink: | ||
<li><a href="${nextlink}" aria-label="${messages("Older posts")}"><span aria-hidden="true">»</span></a></li> | ||
% else: | ||
<li class="disabled"><a href="#" aria-label="${messages("Older posts")}"><span aria-hidden="true">»</span></a></li> | ||
% endif | ||
</ul> | ||
</nav> | ||
</%def> |