Class: Material::List

Inherits:
Collectible::CollectionBase
  • Object
show all
Includes:
Collection, Components, Display, For, Format, Mount, Pagination, Site, Text
Defined in:
lib/material/list.rb

Constant Summary

Constants included from Text

Text::DEFAULT_TRUNCATE_LENGTH

Constants included from Components

Components::CLASSES_TO_DUPLICATE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Collection

#to_ary

Methods included from Mount

#mount_facet

Methods included from Pagination

#initialize

Class Method Details

.for(object) ⇒ Object



16
17
18
19
# File 'lib/material/list.rb', line 16

def for(object)
  material_class = material_class_for(object, "List")
  material_class.new if material_class.present?
end

Instance Method Details

#contextualize(parent) ⇒ Object



22
23
24
# File 'lib/material/list.rb', line 22

def contextualize(parent)
  @context_parent = parent
end

#default_parentObject



26
27
28
# File 'lib/material/list.rb', line 26

def default_parent
  @context_parent
end

#default_titleObject



30
31
32
# File 'lib/material/list.rb', line 30

def default_title
  (item_class.try(:model_name)&.human || item_class&.name).pluralize || self.class.name
end