Class: Locomotive::Page

Instance Method Summary collapse

Methods included from Extensions::Page::Templatized

#fetch_target_entry, #target_entry_name, #target_klass, #target_klass_slug, #target_klass_slug=

Methods included from Extensions::Page::Render

#render

Methods included from Extensions::Page::Parse

#force_serialize_template, #template

Methods included from Extensions::Page::EditableElements

#add_or_update_editable_element, #disable_all_editable_elements, #disable_parent_editable_elements, #editable_element_blocks, #editable_elements_grouped_by_blocks, #enable_editable_elements, #enabled_editable_elements, #find_editable_element, #find_editable_elements, #find_editable_files, #merge_editable_elements_from_page, #remove_disabled_editable_elements

Methods included from Extensions::Page::Tree

#children_with_minimal_attributes, #depth, #siblings_and_self_with_scoping, #sort_children!

Instance Method Details

#default_response_type?Boolean

Returns:



80
81
82
# File 'app/models/locomotive/page.rb', line 80

def default_response_type?
  self.response_type == 'text/html'
end

#index?Boolean

methods ##

Returns:



60
61
62
# File 'app/models/locomotive/page.rb', line 60

def index?
  self.slug == 'index' && self.depth.to_i == 0
end

#index_or_not_found?Boolean

Returns:



72
73
74
# File 'app/models/locomotive/page.rb', line 72

def index_or_not_found?
  self.index? || self.not_found?
end

#latest_updatedObject

named scopes ##



# File 'app/models/locomotive/page.rb', line 49

#not_found?Boolean

Returns:



64
65
66
# File 'app/models/locomotive/page.rb', line 64

def not_found?
  self.slug == '404' && self.depth.to_i == 0
end

#siteObject

validations ##



28
# File 'app/models/locomotive/page.rb', line 28

belongs_to :site, :class_name => 'Locomotive::Site'

#site_idObject

indexes ##



31
# File 'app/models/locomotive/page.rb', line 31

index :site_id

#titleObject

fields ##



17
# File 'app/models/locomotive/page.rb', line 17

field :title,               :localize => true

#translated?Boolean

Returns:



84
85
86
# File 'app/models/locomotive/page.rb', line 84

def translated?
  self.title_translations.key?(::Mongoid::Fields::I18n.locale.to_s) rescue false
end

#translated_inObject



88
89
90
# File 'app/models/locomotive/page.rb', line 88

def translated_in
  self.title_translations.keys
end

#unpublished?Boolean

Returns:



68
69
70
# File 'app/models/locomotive/page.rb', line 68

def unpublished?
  !self.published?
end

#with_cache?Boolean

Returns:



76
77
78
# File 'app/models/locomotive/page.rb', line 76

def with_cache?
  self.cache_strategy != 'none'
end