Class: Locomotive::Page
- Inherits:
-
Object
show all
- Includes:
- Concerns::Page::EditableElements, Concerns::Page::Layout, Concerns::Page::Listed, Concerns::Page::Redirect, Concerns::Page::Sections, Concerns::Page::Templatized, Concerns::Page::ToSteam, Concerns::Page::Tree, Concerns::Shared::Seo, Concerns::Shared::SiteScope, Concerns::Shared::Slug, Concerns::Shared::Userstamp, Mongoid::Document
- Defined in:
- app/models/locomotive/page.rb
Constant Summary
collapse
- MINIMAL_ATTRIBUTES =
%w(_id title slug fullpath position depth published templatized target_klass_name redirect listed response_type parent_id parent_ids site_id created_at updated_at raw_template is_layout)
Concerns::Page::Layout::BLOCK_REGEX, Concerns::Page::Layout::EXTENDS_FULLPATH_REGEX, Concerns::Page::Layout::EXTENDS_PARENT_REGEX, Concerns::Page::Layout::EXTENDS_REGEX, Concerns::Page::Layout::IS_LAYOUT_REGEX
Instance Attribute Summary collapse
Instance Method Summary
collapse
#all_sections_content
#to_steam
#content_type, #content_type_id, #content_type_with_main_attributes, #fetch_target_entries, #fetch_target_entry, #target_entry_name, #target_klass, #target_klass_slug, #target_klass_slug=
#find_layout, #is_layout_or_related?, #use_layout?
#find_editable_element
#children_with_minimal_attributes, #depth, #sort_children!
Instance Attribute Details
#skip_callbacks_on_update ⇒ Object
Returns the value of attribute skip_callbacks_on_update.
71
72
73
|
# File 'app/models/locomotive/page.rb', line 71
def skip_callbacks_on_update
@skip_callbacks_on_update
end
|
Instance Method Details
#default_response_type? ⇒ Boolean
91
92
93
|
# File 'app/models/locomotive/page.rb', line 91
def default_response_type?
self.response_type == 'text/html'
end
|
103
104
105
|
# File 'app/models/locomotive/page.rb', line 103
def hidden?
(self.display_settings || {})['hidden'] || false
end
|
75
76
77
|
# File 'app/models/locomotive/page.rb', line 75
def index?
self.slug == 'index' && self.depth.to_i == 0
end
|
#index_or_not_found? ⇒ Boolean
87
88
89
|
# File 'app/models/locomotive/page.rb', line 87
def index_or_not_found?
self.index? || self.not_found?
end
|
#latest_updated ⇒ Object
59
|
# File 'app/models/locomotive/page.rb', line 59
scope :latest_updated, -> { order_by(updated_at: :desc).limit(Locomotive.config.ui[:latest_entries_nb]) }
|
79
80
81
|
# File 'app/models/locomotive/page.rb', line 79
def not_found?
self.slug == '404' && self.depth.to_i == 0
end
|
#title ⇒ Object
23
|
# File 'app/models/locomotive/page.rb', line 23
field :title, localize: true
|
#touch_site_attribute ⇒ Object
113
114
115
|
# File 'app/models/locomotive/page.rb', line 113
def touch_site_attribute
self.raw_template_changed? ? :template_version : :content_version
end
|
#translated? ⇒ Boolean
95
96
97
|
# File 'app/models/locomotive/page.rb', line 95
def translated?
self.title_translations.key?(::Mongoid::Fields::I18n.locale.to_s) rescue false
end
|
#translated_in ⇒ Object
99
100
101
|
# File 'app/models/locomotive/page.rb', line 99
def translated_in
self.title_translations.try(:keys)
end
|
#unpublished? ⇒ Boolean
83
84
85
|
# File 'app/models/locomotive/page.rb', line 83
def unpublished?
!self.published?
end
|
#update_without_validation_and_callback! ⇒ Object
107
108
109
110
111
|
# File 'app/models/locomotive/page.rb', line 107
def update_without_validation_and_callback!
self.updating_descendants = true
self.save(validate: false)
self.updating_descendants = false
end
|