2024-01-22 19:48:38 -06:00
|
|
|
<%# The container tag
|
|
|
|
- available local variables
|
|
|
|
current_page: a page object for the currently displayed page
|
|
|
|
total_pages: total number of pages
|
|
|
|
per_page: number of items to fetch per page
|
|
|
|
remote: data-remote
|
|
|
|
paginator: the paginator that renders the pagination tags inside
|
|
|
|
-%>
|
|
|
|
<%= paginator.render do -%>
|
|
|
|
<nav aria-label="Page navigation">
|
|
|
|
<ul class="pagination">
|
|
|
|
<li class="page-item <%= 'disabled' if current_page.first? %>">
|
2024-01-22 21:22:29 -06:00
|
|
|
<%= link_to 'First', participants_path(page: 1), class: 'page-link bg-secondary text-white' unless current_page.first? %>
|
2024-01-22 19:48:38 -06:00
|
|
|
</li>
|
|
|
|
<li class="page-item <%= 'disabled' if current_page.first? %>">
|
2024-01-22 21:22:29 -06:00
|
|
|
<%= link_to 'Previous', participants_path(page: current_page.number - 1), class: 'page-link bg-secondary text-white' unless current_page.first? %>
|
2024-01-22 19:48:38 -06:00
|
|
|
</li>
|
|
|
|
<% each_page do |page| -%>
|
|
|
|
<% if page.display_tag? -%>
|
|
|
|
<li class="page-item <%= 'active' if page.number == current_page.number %>">
|
2024-01-22 21:22:29 -06:00
|
|
|
<%= link_to page.number, participants_path(page: page.number), class: 'page-link bg-secondary text-white' %>
|
|
|
|
</li>
|
2024-01-22 19:48:38 -06:00
|
|
|
<% elsif !page.was_truncated? -%>
|
2024-01-22 21:22:29 -06:00
|
|
|
<li class="page-item disabled"><span class="page-link bg-secondary text-white">…</span></li>
|
2024-01-22 19:48:38 -06:00
|
|
|
<% end -%>
|
|
|
|
<% end -%>
|
|
|
|
<li class="page-item <%= 'disabled' if current_page.last? %>">
|
2024-01-22 21:22:29 -06:00
|
|
|
<%= link_to 'Next', participants_path(page: current_page.number + 1), class: 'page-link bg-secondary text-white' unless current_page.last? %>
|
2024-01-22 19:48:38 -06:00
|
|
|
</li>
|
|
|
|
<li class="page-item <%= 'disabled' if current_page.last? %>">
|
2024-01-22 21:22:29 -06:00
|
|
|
<%= link_to 'Last', participants_path(page: total_pages), class: 'page-link bg-secondary text-white' unless current_page.last? %>
|
2024-01-22 19:48:38 -06:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
<% end -%>
|