-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
3 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
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,41 @@ | ||
<%# | ||
The link variable is set to a proc that returns the link tag (complete with rel and aria-current) | ||
Usage: link.call( page_number [, text [, extra_attributes_string ]]) | ||
-%> | ||
<% link = pagy_link_proc(pagy) -%> | ||
<nav class="pagy_nav pagination" aria-label="Pages"> | ||
<%# Previous page link %> | ||
<% if pagy.prev -%> | ||
<span class="page prev"> | ||
<%== link.call(pagy.prev, '<', 'aria-label="Previous"') %> | ||
</span> | ||
<% else -%> | ||
<span class="page prev disabled"> | ||
<a role="link" aria-disabled="true" aria-label="Previous"><</a> | ||
</span> | ||
<% end -%> | ||
<%# Page links (series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]) %> | ||
<% pagy.series.each do |item| -%> | ||
<% if item.is_a?(Integer) -%> | ||
<span class="page"> | ||
<%== link.call(item) %> | ||
</span> | ||
<% elsif item.is_a?(String) -%> | ||
<span class="page active"> | ||
<a role="link" aria-disabled="true" aria-current="page"><%== item %></a> | ||
</span> | ||
<% elsif item == :gap -%> | ||
<span class="page gap">…</span> | ||
<% end -%> | ||
<% end -%> | ||
<%# Next page link %> | ||
<% if pagy.next -%> | ||
<span class="page next"> | ||
<%== link.call(pagy.next, '>', 'aria-label="Next"') %> | ||
</span> | ||
<% else -%> | ||
<span class="page next disabled"> | ||
<a role="link" aria-disabled="true" aria-label="Next">></a> | ||
</span> | ||
<% end -%> | ||
</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