Class: Spark::Checklist::Container
- Inherits:
-
Spark::Component::Base
- Object
- ActionView::Component::Base
- Spark::Component::Base
- Spark::Checklist::Container
- Defined in:
- app/components/spark/checklist/container.rb
Instance Method Summary collapse
-
#initialize ⇒ Container
constructor
A new instance of Container.
- #sort_items ⇒ Object
Methods inherited from Spark::Component::Base
Constructor Details
#initialize ⇒ Container
Returns a new instance of Container.
11 12 13 14 15 16 |
# File 'app/components/spark/checklist/container.rb', line 11 def initialize(*) super data.add checklist_id: unique_id classname.base = 'spark-checklist-container' end |
Instance Method Details
#sort_items ⇒ Object
18 19 20 21 22 |
# File 'app/components/spark/checklist/container.rb', line 18 def sort_items items.sort_by! { |item| item.attribute_completed ? 1 : 0 } add_collapse_item_class if @collapse_after items end |