Sha256: 2c4550bd9fd9411c663d41cb1dc831256ea23f6f57fc90d80f5c3df766c7b6e8

Contents?: true

Size: 695 Bytes

Versions: 20

Compression:

Stored size: 695 Bytes

Contents

# typed: false
# frozen_string_literal: true

module Ariadne
  module UI
    module Pagination
      class Component < Ariadne::BaseComponent
        option :label
        option :goto_label

        option :current_page
        option :pages_count

        option :callback_page_url

        option :page_size_options, default: proc { [10, 25, 50, 100] }

        def page_links
          (1..pages_count).each_with_object([]) do |page, list|
            if [1, pages_count].include?(page) || page.between?(current_page - 2, current_page + 2)
              list << page
            elsif list.last
              list << nil
            end
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.93.2 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.93.1 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.93 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.92 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.91 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.90 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.89.1 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.89 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.88 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.87 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.9 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.8 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.7 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.6 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.5 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.4 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.3 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.2 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86.1 app/components/ariadne/ui/pagination/component.rb
ariadne_view_components-0.0.86 app/components/ariadne/ui/pagination/component.rb