Sha256: 61cbe17c8ecdb4b22637c1001fcb18a98054cb6835a3045cea9c58543a322e8f

Contents?: true

Size: 1.11 KB

Versions: 656

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require "will_paginate/view_helpers/action_view"

module Playbook
  module Pagination
    class Rails < WillPaginate::ActionView::LinkRenderer
      def container_attributes
        { class: "pb_pagination" }
      end

      def page_number(page)
        if page == current_page
          tag("li", tag("span", page), class: "active")
        else
          tag("li", link(page, page, rel: rel_value(page)))
        end
      end

      def previous_or_next_page(page, text, classname)
        if page
          tag("li", link(text, page), class: classname)
        else
          tag("li", tag("span", text), class: "%s disabled")
        end
      end

      def gap; end

      def previous_page
        num = @collection.current_page > 1 && @collection.current_page - 1
        previous_or_next_page(num, "<i class='far fa-chevron-left fa-xs'></i>", "prev")
      end

      def next_page
        num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
        previous_or_next_page(num, "<i class='far fa-chevron-right fa-xs'></i>", "next")
      end
    end
  end
end

Version data entries

656 entries across 656 versions & 1 rubygems

Version Path
playbook_ui-14.0.0.pre.alpha.PBNTR415starratingform3493 lib/playbook/pagination_renderer.rb
playbook_ui-14.0.0.pre.alpha.PBNTR415starratingform3492 lib/playbook/pagination_renderer.rb
playbook_ui-14.0.0.pre.alpha.PLAY1475bumpaxecoredependency3483 lib/playbook/pagination_renderer.rb
playbook_ui-14.0.0.pre.alpha.PLAY14733479 lib/playbook/pagination_renderer.rb
playbook_ui-14.0.0.pre.alpha.dependabotnpmandyarnreactjoyride2823478 lib/playbook/pagination_renderer.rb
playbook_ui-14.0.0.pre.alpha.PLAY14113475 lib/playbook/pagination_renderer.rb
playbook_ui-14.0.0.pre.alpha.play1447alphatest3462 lib/playbook/pagination_renderer.rb
playbook_ui-14.1.0 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.play1447addrequiredicons3455 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.play1447addrequiredicons3451 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.PLAY14043436 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.pbntr258paginationkitforreact3413 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.pbntr258paginationkitforreact3411 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.pbntr258paginationkitforreact3409 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.pbntr258paginationkitforreact3404 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.powerfontsexternal3403 lib/playbook/pagination_renderer.rb
playbook_ui-14.0.0 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.PLAY14633399 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 lib/playbook/pagination_renderer.rb
playbook_ui-13.34.1.pre.alpha.PLAY14703378 lib/playbook/pagination_renderer.rb