Class: Administrate::Page::Collection

Inherits:
Base
  • Object
show all
Defined in:
lib/administrate/page/collection.rb

Instance Method Summary collapse

Methods inherited from Base

#collection_includes, #initialize, #item_associations, #item_includes, #resource_name, #resource_path

Constructor Details

This class inherits a constructor from Administrate::Page::Base

Instance Method Details

#attribute_namesObject



6
7
8
9
# File 'lib/administrate/page/collection.rb', line 6

def attribute_names
  options.fetch(:collection_attributes, nil) ||
    dashboard.collection_attributes
end

#attribute_typesObject



17
18
19
# File 'lib/administrate/page/collection.rb', line 17

def attribute_types
  dashboard.attribute_types_for(attribute_names)
end

#attributes_for(resource) ⇒ Object



11
12
13
14
15
# File 'lib/administrate/page/collection.rb', line 11

def attributes_for(resource)
  attribute_names.map do |attr_name|
    attribute_field(dashboard, resource, attr_name, :index)
  end
end

#order_params_for(attr, key: resource_name) ⇒ Object



27
28
29
# File 'lib/administrate/page/collection.rb', line 27

def order_params_for(attr, key: resource_name)
  {key => order.order_params_for(attr)}
end

#ordered_html_class(attr) ⇒ Object



21
22
23
# File 'lib/administrate/page/collection.rb', line 21

def ordered_html_class(attr)
  ordered_by?(attr) && order.direction
end