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
- #path ⇒ Object
- #published_in?(locale) ⇒ Boolean
- #use_as_index ⇒ Object
- #use_as_index=(value) ⇒ Object
- #web_title(locale: Locale.default) ⇒ Object
Instance Method Details
#path ⇒ Object
46 47 48 |
# File 'app/models/iron/entry/web_publishable.rb', line 46 def path content_type.path_for(self) if content_type.web_publishing_enabled? end |
#published_in?(locale) ⇒ Boolean
36 37 38 39 40 41 42 43 44 |
# File 'app/models/iron/entry/web_publishable.rb', line 36 def published_in?(locale) return false unless content_type.web_publishing_enabled? if content_type.web_page_title_field_definition web_title(locale: locale).present? else translated_in?(locale) end end |
#use_as_index ⇒ Object
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_title(locale: Locale.default) ⇒ Object
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(locale: Locale.default) return nil unless content_type.web_page_title_field_definition title_field = fields.find_by( definition: content_type.web_page_title_field_definition, locale: locale ) || fields.detect { |f| f.definition_id == content_type.web_page_title_field_definition_id && f.locale_id == locale&.id } title_field&.value end |