Class: Locomotive::Steam::Page
- Inherits:
-
Object
- Object
- Locomotive::Steam::Page
- Includes:
- Models::Entity
- Defined in:
- lib/locomotive/steam/entities/page.rb
Instance Attribute Summary collapse
-
#_fullpath ⇒ Object
Returns the value of attribute _fullpath.
-
#content_entry ⇒ Object
Returns the value of attribute content_entry.
-
#depth ⇒ Object
Returns the value of attribute depth.
Attributes included from Models::Entity
#associations, #attributes, #base_url, #localized_attributes
Instance Method Summary collapse
- #content_type_id ⇒ Object
- #index? ⇒ Boolean
-
#initialize(attributes) ⇒ Page
constructor
A new instance of Page.
- #layout? ⇒ Boolean
- #listed? ⇒ Boolean
- #not_found? ⇒ Boolean
- #published? ⇒ Boolean
- #redirect? ⇒ Boolean
- #source ⇒ Object
- #templatized? ⇒ Boolean
- #to_liquid ⇒ Object
Methods included from Models::Entity
#[], #[]=, #_id, #change, #method_missing, #respond_to?, #serialize
Methods included from Models::Concerns::ToJson
Methods included from Models::Concerns::Validation
Constructor Details
#initialize(attributes) ⇒ Page
Returns a new instance of Page.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/locomotive/steam/entities/page.rb', line 9 def initialize(attributes) super({ handle: nil, listed: false, published: true, templatized: false, cache_enabled: true, fullpath: {}, response_type: nil, content_type: nil, target_klass_name: nil, position: 99, raw_template: nil, source: nil, editable_elements: {}, sections_content: {}, sections_dropzone_content: [], redirect: nil, redirect_url: {}, redirect_type: nil, parent_id: nil, parent_ids: nil, updated_at: Time.zone.now }.merge(attributes)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Locomotive::Steam::Models::Entity
Instance Attribute Details
#_fullpath ⇒ Object
Returns the value of attribute _fullpath.
7 8 9 |
# File 'lib/locomotive/steam/entities/page.rb', line 7 def _fullpath @_fullpath end |
#content_entry ⇒ Object
Returns the value of attribute content_entry.
7 8 9 |
# File 'lib/locomotive/steam/entities/page.rb', line 7 def content_entry @content_entry end |
#depth ⇒ Object
Returns the value of attribute depth.
7 8 9 |
# File 'lib/locomotive/steam/entities/page.rb', line 7 def depth @depth end |
Instance Method Details
#content_type_id ⇒ Object
40 41 42 43 |
# File 'lib/locomotive/steam/entities/page.rb', line 40 def content_type_id self.target_klass_name =~ Locomotive::Steam::CONTENT_ENTRY_ENGINE_CLASS_NAME $1 || self.target_klass_name end |
#index? ⇒ Boolean
45 46 47 |
# File 'lib/locomotive/steam/entities/page.rb', line 45 def index? attributes[:fullpath].values.first == 'index' end |
#layout? ⇒ Boolean
53 54 55 |
# File 'lib/locomotive/steam/entities/page.rb', line 53 def layout? (attributes[:fullpath].values.first =~ Locomotive::Steam::IsLAYOUT) == 0 end |
#listed? ⇒ Boolean
35 |
# File 'lib/locomotive/steam/entities/page.rb', line 35 def listed?; !!listed; end |
#not_found? ⇒ Boolean
49 50 51 |
# File 'lib/locomotive/steam/entities/page.rb', line 49 def not_found? attributes[:fullpath].values.first == '404' end |
#published? ⇒ Boolean
36 |
# File 'lib/locomotive/steam/entities/page.rb', line 36 def published?; !!published; end |
#redirect? ⇒ Boolean
38 |
# File 'lib/locomotive/steam/entities/page.rb', line 38 def redirect?; redirect.nil? ? !redirect_url.blank? : redirect; end |
#source ⇒ Object
57 58 59 |
# File 'lib/locomotive/steam/entities/page.rb', line 57 def source self[:raw_template] end |
#templatized? ⇒ Boolean
37 |
# File 'lib/locomotive/steam/entities/page.rb', line 37 def templatized?; !!templatized; end |