Class: Iron::ContentType
Defined Under Namespace
Modules: Exportable, FieldQueryable, Importable, Titlable, WebPublishable
Constant Summary
collapse
- TYPES =
%w[Single Collection].freeze
- DEFAULT_ICON =
"file-text"
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Titlable
#titlable_definitions
#index_entry, #path_for
Methods included from Exportable
#export_attributes
Class Method Details
.classify_type(type) ⇒ Object
24
25
26
|
# File 'app/models/iron/content_type.rb', line 24
def classify_type(type)
"Iron::ContentTypes::#{type}"
end
|
.inherited(subclass) ⇒ Object
28
29
30
31
32
33
|
# File 'app/models/iron/content_type.rb', line 28
def inherited(subclass)
super
def subclass.model_name
superclass.model_name
end
end
|
Instance Method Details
#collection? ⇒ Boolean
48
49
50
|
# File 'app/models/iron/content_type.rb', line 48
def collection?
is_a?(ContentTypes::Collection)
end
|
#display_icon ⇒ Object
40
41
42
|
# File 'app/models/iron/content_type.rb', line 40
def display_icon
icon.presence.then { |name| IconCatalog.include?(name) ? name : nil } || DEFAULT_ICON
end
|
#humanized_type ⇒ Object
36
37
38
|
# File 'app/models/iron/content_type.rb', line 36
def humanized_type
type.demodulize
end
|
#single? ⇒ Boolean
44
45
46
|
# File 'app/models/iron/content_type.rb', line 44
def single?
is_a?(ContentTypes::Single)
end
|