Skip to content

Instantly share code, notes, and snippets.

@hachy
Forked from manemone/_first_page.html.haml
Last active February 26, 2017 06:50
Show Gist options
  • Save hachy/3dd2f674c0d269369ae656f9406e87af to your computer and use it in GitHub Desktop.
Save hachy/3dd2f674c0d269369ae656f9406e87af to your computer and use it in GitHub Desktop.
v4.0.0-alpha.6 kaminari のページネーションリンクに Twitter Bootstrap 4 のスタイルを適用する ref: http://qiita.com/manemone@github/items/564c58ea59fb3450826c
%li.page-item.prev{ class: "#{'disabled' if current_page.first?}" }
= link_to (current_page.first? ? "#" : url), class: "page-link", "aria-label" => "First", :remote => remote do
%span{"aria-hidden" => "true"} «
%span.sr-only
= t('views.pagination.first').html_safe
%li.page-item.gap
.page-link
= t('views.pagination.truncate').html_safe
%li.page-item.next{ class: "#{'disabled' if current_page.last?}" }
= link_to (current_page.last? ? "#" : url), class: "page-link", "aria-label" => "Last", :remote => remote do
%span{"aria-hidden" => "true"} »
%span.sr-only
= t('views.pagination.last').html_safe
%li.page-item.next{ class: "#{'disabled' if current_page.last?}" }
= link_to (current_page.last? ? "#" : url), class: "page-link", "aria-label" => "Next", :remote => remote do
%span{"aria-hidden" => "true"} ›
%span.sr-only
= t('views.pagination.next').html_safe
%li.page-item{ class: "#{'active' if page.current?}" }
= link_to url, class: "page-link", remote: remote do
= page
- if page.current?
%span.sr-only (current)
= paginator.render do
%nav.text-center
%ul.pagination
= first_page_tag unless current_page.first?
= prev_page_tag unless current_page.first?
- each_page do |page|
- if page.left_outer? || page.right_outer? || page.inside_window?
= page_tag page
- elsif !page.was_truncated?
= gap_tag
= next_page_tag unless current_page.last?
= last_page_tag unless current_page.last?
%li.page-item.prev{ class: "#{'disabled' if current_page.first?}" }
= link_to (current_page.first? ? "#" : url), class: "page-link", "aria-label" => "Previous", :remote => remote do
%span{"aria-hidden" => "true"} ‹
%span.sr-only
= t('views.pagination.previous').html_safe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment