Class: Spark::Checklist::Container

Inherits:
Spark::Component::Base show all
Defined in:
app/components/spark/checklist/container.rb

Instance Method Summary collapse

Methods inherited from Spark::Component::Base

#selector, #to_s, #unique_id

Constructor Details

#initializeContainer

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_itemsObject



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