Class: Component::CollectionTable
- Defined in:
- app/components/component/collection_table.rb
Constant Summary collapse
- SIZE_MAP =
{ default: nil, small: :sm }
Instance Method Summary collapse
- #association(name, options = {}, &block) ⇒ Object
- #column(name, options = {}, &block) ⇒ Object
-
#initialize(*args) ⇒ CollectionTable
constructor
A new instance of CollectionTable.
- #timestamps(options = {}) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(*args) ⇒ CollectionTable
Returns a new instance of CollectionTable.
8 9 10 11 12 13 |
# File 'app/components/component/collection_table.rb', line 8 def initialize(*args) super @columns = {} @collection = .delete(:collection) @resource_class = .delete(:resource_class) || @collection.first.class end |
Instance Method Details
#association(name, options = {}, &block) ⇒ Object
25 26 27 28 |
# File 'app/components/component/collection_table.rb', line 25 def association(name, = {}, &block) .reverse_merge!(block: block) if block_given? @columns[name] = end |
#column(name, options = {}, &block) ⇒ Object
15 16 17 18 |
# File 'app/components/component/collection_table.rb', line 15 def column(name, = {}, &block) .reverse_merge!(block: block) if block_given? @columns[name] = end |
#timestamps(options = {}) ⇒ Object
20 21 22 23 |
# File 'app/components/component/collection_table.rb', line 20 def ( = {}) column(:created_at, ) column(:updated_at, ) end |