Module: Iron::Entry::WebPublishable

Extended by:
ActiveSupport::Concern
Included in:
Iron::Entry
Defined in:
app/models/iron/entry/web_publishable.rb

Instance Method Summary collapse

Instance Method Details

#pathObject



36
37
38
# File 'app/models/iron/entry/web_publishable.rb', line 36

def path
  content_type.path_for(self) if content_type.web_publishing_enabled?
end

#use_as_indexObject



18
19
20
# File 'app/models/iron/entry/web_publishable.rb', line 18

def use_as_index
  route == ""
end

#use_as_index=(value) ⇒ Object



14
15
16
# File 'app/models/iron/entry/web_publishable.rb', line 14

def use_as_index=(value)
  @use_as_index_intent = ActiveModel::Type::Boolean.new.cast(value)
end

#web_titleObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/iron/entry/web_publishable.rb', line 22

def web_title
  return nil unless content_type.web_page_title_field_definition

  title_field = fields.find_by(
    definition: content_type.web_page_title_field_definition,
    locale: Iron::Locale.default
  ) || fields.detect { |f|
    f.definition_id == content_type.web_page_title_field_definition_id &&
    f.locale == Iron::Locale.default
  }

  title_field&.value
end