Class: Spina::Pages::ListComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Spina::Pages::ListComponent
- Defined in:
- app/components/spina/pages/list_component.rb
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#draggable ⇒ Object
readonly
Returns the value of attribute draggable.
-
#paginated ⇒ Object
readonly
Returns the value of attribute paginated.
-
#sortable ⇒ Object
readonly
Returns the value of attribute sortable.
Instance Method Summary collapse
-
#initialize(pages:, sortable: true, draggable: nil) ⇒ ListComponent
constructor
A new instance of ListComponent.
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
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
4 5 6 |
# File 'app/components/spina/pages/list_component.rb', line 4 def depth @depth end |
#draggable ⇒ Object (readonly)
Returns the value of attribute draggable.
4 5 6 |
# File 'app/components/spina/pages/list_component.rb', line 4 def draggable @draggable end |
#paginated ⇒ Object (readonly)
Returns the value of attribute paginated.
4 5 6 |
# File 'app/components/spina/pages/list_component.rb', line 4 def paginated @paginated end |
#sortable ⇒ Object (readonly)
Returns the value of attribute sortable.
4 5 6 |
# File 'app/components/spina/pages/list_component.rb', line 4 def sortable @sortable end |