Class: Spina::Pages::ListComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/spina/pages/list_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pages:, sortable: true, draggable: nil) ⇒ ListComponent

Returns a new instance of ListComponent.



6
7
8
9
10
11
12
13
14
# File 'app/components/spina/pages/list_component.rb', line 6

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

Instance Attribute Details

#depthObject (readonly)

Returns the value of attribute depth.



4
5
6
# File 'app/components/spina/pages/list_component.rb', line 4

def depth
  @depth
end

#draggableObject (readonly)

Returns the value of attribute draggable.



4
5
6
# File 'app/components/spina/pages/list_component.rb', line 4

def draggable
  @draggable
end

#paginatedObject (readonly)

Returns the value of attribute paginated.



4
5
6
# File 'app/components/spina/pages/list_component.rb', line 4

def paginated
  @paginated
end

#sortableObject (readonly)

Returns the value of attribute sortable.



4
5
6
# File 'app/components/spina/pages/list_component.rb', line 4

def sortable
  @sortable
end