-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move pagination to partial, show at bottom and top of page, resolves #74
- Loading branch information
1 parent
95663aa
commit b8e2b13
Showing
5 changed files
with
82 additions
and
356 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<%- include("./isDefaultCSS/pagination.ejs") %> | ||
<nav class="pagination is-centered" role="navigation" aria-label="pagination"> | ||
<a class="pagination-previous" <% if (Number(req.query.page) <= 1) { %>disabled<% } else { %>href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %><%= Number(req.query.page) - 1 %>"<% } %>><%= __("common.pagination.previous") %></a> | ||
<a class="pagination-next" <% if (Number(req.query.page) >= pages) { %>disabled<% } else { %>href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %><%= Number(req.query.page) + 1 %>"<% } %>><%= __("common.pagination.next") %></a> | ||
<ul class="pagination-list"> | ||
<% if (Number(req.query.page) <= 3) { %> | ||
<li> | ||
<% if (Number(req.query.page) === 1) { %> | ||
<a class="pagination-link is-current" aria-label="<%= __("common.pagination.page", "1") %>" aria-current="page">1</a> | ||
<% } else { %> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %>1" aria-label="<%= __("common.pagination.gotoPage", "1") %>">1</a> | ||
<% } %> | ||
</li> | ||
<% if (2 <= pages) { %> | ||
<% if (Number(req.query.page) === 2) { %> | ||
<a class="pagination-link is-current" aria-label="<%= __("common.pagination.page", "2") %>" aria-current="page">2</a> | ||
<% } else { %> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %>2" aria-label="<%= __("common.pagination.gotoPage", "2") %>">2</a> | ||
<% } %> | ||
<% } %> | ||
<% if (3 <= pages) { %> | ||
<li> | ||
<% if (Number(req.query.page) === 3) { %> | ||
<a class="pagination-link is-current" aria-label="<%= __("common.pagination.page", "3") %>" aria-current="page">3</a> | ||
<% } else { %> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %>3" aria-label="<%= __("common.pagination.gotoPage", "3") %>">3</a> | ||
<% } %> | ||
</li> | ||
<% } %> | ||
<% if (pages > 3) { %> | ||
<li> | ||
<span class="pagination-ellipsis">…</span> | ||
</li> | ||
<li> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %><%= pages %>" aria-label="<%= __("common.pagination.gotoPage", pages) %>"><%= pages %></a> | ||
</li> | ||
<% } %> | ||
<% } else { %> | ||
<li> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %>1" aria-label="<%= __("common.pagination.gotoPage", "1") %>">1</a> | ||
</li> | ||
<li> | ||
<span class="pagination-ellipsis">…</span> | ||
</li> | ||
<% if (Number(req.query.page) === pages) { %> | ||
<li> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %><%= Number(req.query.page) - 2 %>" aria-label="<%= __("common.pagination.gotoPage", Number(req.query.page) - 2) %>"><%= Number(req.query.page) - 2 %></a> | ||
</li> | ||
<% } %> | ||
<li> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %><%= Number(req.query.page) - 1 %>" aria-label="<%= __("common.pagination.gotoPage", Number(req.query.page) - 1) %>"><%= Number(req.query.page) - 1 %></a> | ||
</li> | ||
<li> | ||
<a class="pagination-link is-current" aria-label="<%= __("common.pagination.page", req.query.page) %>" aria-current="page"><%= req.query.page %></a> | ||
</li> | ||
<% if (Number(req.query.page) !== pages) { %> | ||
<li> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %><%= Number(req.query.page) + 1 %>" aria-label="<%= __("common.pagination.gotoPage", Number(req.query.page) + 1) %>"><%= Number(req.query.page) + 1 %></a> | ||
</li> | ||
<% } %> | ||
<% if (Number(req.query.page <= (pages - 2))) { %> | ||
<li> | ||
<span class="pagination-ellipsis">…</span> | ||
</li> | ||
<li> | ||
<a class="pagination-link" href="<%= linkPrefix %>/<%= linkLocation %><%= pageParam %><%= pages %>" aria-label="<%= __("common.pagination.gotoPage", pages) %>"><%= pages %></a> | ||
</li> | ||
<% } %> | ||
<% } %> | ||
</ul> | ||
</nav> |
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
Oops, something went wrong.