obdev/app/views/kaminari/_paginator.html.erb

36 lines
1.8 KiB
Plaintext

<%# 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? %>">
<%= link_to 'First', participants_path(page: 1), class: 'page-link bg-secondary text-white' unless current_page.first? %>
</li>
<li class="page-item <%= 'disabled' if current_page.first? %>">
<%= link_to 'Previous', participants_path(page: current_page.number - 1), class: 'page-link bg-secondary text-white' unless current_page.first? %>
</li>
<% each_page do |page| -%>
<% if page.display_tag? -%>
<li class="page-item <%= 'active' if page.number == current_page.number %>">
<%= link_to page.number, participants_path(page: page.number), class: 'page-link bg-secondary text-white' %>
</li>
<% elsif !page.was_truncated? -%>
<li class="page-item disabled"><span class="page-link bg-secondary text-white">…</span></li>
<% end -%>
<% end -%>
<li class="page-item <%= 'disabled' if current_page.last? %>">
<%= link_to 'Next', participants_path(page: current_page.number + 1), class: 'page-link bg-secondary text-white' unless current_page.last? %>
</li>
<li class="page-item <%= 'disabled' if current_page.last? %>">
<%= link_to 'Last', participants_path(page: total_pages), class: 'page-link bg-secondary text-white' unless current_page.last? %>
</li>
</ul>
</nav>
<% end -%>