Sha256: 1eda947b4a5c69c0a69a81c3b6fcd742da68f2ac71a1f7ce15437e1561d4473b

Contents?: true

Size: 505 Bytes

Versions: 8

Compression:

Stored size: 505 Bytes

Contents

module Spina
  module Pages
    class ListComponent < ApplicationComponent
      attr_reader :depth, :sortable, :draggable, :paginated

      def initialize(pages:, sortable: true, draggable: nil)
        @pages = pages
        @sortable = sortable

        # List of pages is only draggable if there's no pagination
        @paginated = pages.respond_to?(:total_pages)
        @draggable = draggable
        @draggable = !paginated || pages.total_pages == 1 if draggable.nil?
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spina-2.18.0 app/components/spina/pages/list_component.rb
spina-2.17.0 app/components/spina/pages/list_component.rb
spina-2.16.0 app/components/spina/pages/list_component.rb
spina-2.15.1 app/components/spina/pages/list_component.rb
spina-2.15.0 app/components/spina/pages/list_component.rb
spina-2.14.0 app/components/spina/pages/list_component.rb
spina-2.13.1 app/components/spina/pages/list_component.rb
spina-2.13.0 app/components/spina/pages/list_component.rb