Class: Maglev::Uikit::List::ListComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Maglev::Uikit::List::ListComponent
- Defined in:
- app/components/maglev/uikit/list/list_component.rb
Instance Attribute Summary collapse
-
#html_options ⇒ Object
readonly
Returns the value of attribute html_options.
-
#sort_form ⇒ Object
readonly
Returns the value of attribute sort_form.
-
#sortable_scope ⇒ Object
readonly
Returns the value of attribute sortable_scope.
Instance Method Summary collapse
-
#initialize(sort_form: nil, sortable_scope: nil, html_options: {}) ⇒ ListComponent
constructor
A new instance of ListComponent.
- #sort_form_data ⇒ Object
- #sort_form_path ⇒ Object
- #sortable? ⇒ Boolean
Methods inherited from BaseComponent
Constructor Details
#initialize(sort_form: nil, sortable_scope: nil, html_options: {}) ⇒ ListComponent
Returns a new instance of ListComponent.
14 15 16 17 18 |
# File 'app/components/maglev/uikit/list/list_component.rb', line 14 def initialize(sort_form: nil, sortable_scope: nil, html_options: {}) @sort_form = sort_form @sortable_scope = sortable_scope @html_options = end |
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
12 13 14 |
# File 'app/components/maglev/uikit/list/list_component.rb', line 12 def @html_options end |
#sort_form ⇒ Object (readonly)
Returns the value of attribute sort_form.
12 13 14 |
# File 'app/components/maglev/uikit/list/list_component.rb', line 12 def sort_form @sort_form end |
#sortable_scope ⇒ Object (readonly)
Returns the value of attribute sortable_scope.
12 13 14 |
# File 'app/components/maglev/uikit/list/list_component.rb', line 12 def sortable_scope @sortable_scope end |
Instance Method Details
#sort_form_data ⇒ Object
24 25 26 |
# File 'app/components/maglev/uikit/list/list_component.rb', line 24 def sort_form_data { sortable_target: 'sortableForm' }.merge(sort_form[:data] || {}) end |
#sort_form_path ⇒ Object
20 21 22 |
# File 'app/components/maglev/uikit/list/list_component.rb', line 20 def sort_form_path sort_form&.fetch(:path) end |
#sortable? ⇒ Boolean
28 29 30 |
# File 'app/components/maglev/uikit/list/list_component.rb', line 28 def sortable? sort_form_path.present? end |