Class: Locomotive::Steam::Page
- Inherits:
-
Object
- Object
- Locomotive::Steam::Page
show all
- Includes:
- Models::Entity
- Defined in:
- lib/locomotive/steam/entities/page.rb
Instance Attribute Summary collapse
#associations, #attributes, #base_url, #localized_attributes
Instance Method Summary
collapse
#[], #[]=, #_id, #change, #method_missing, #respond_to?, #serialize
#as_json, #to_hash, #to_json
#errors, #valid?
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
|
# 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: {},
redirect: nil,
redirect_url: {},
redirect_type: nil,
parent_id: nil,
parent_ids: nil,
updated_at: Time.zone.now
}.merge(attributes))
end
|
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
#index? ⇒ Boolean
43
44
45
|
# File 'lib/locomotive/steam/entities/page.rb', line 43
def index?
attributes[:fullpath].values.first == 'index'
end
|
#layout? ⇒ Boolean
51
52
53
|
# File 'lib/locomotive/steam/entities/page.rb', line 51
def layout?
(attributes[:fullpath].values.first =~ Locomotive::Steam::IsLAYOUT) == 0
end
|
#listed? ⇒ Boolean
33
|
# File 'lib/locomotive/steam/entities/page.rb', line 33
def listed?; !!listed; end
|
#not_found? ⇒ Boolean
47
48
49
|
# File 'lib/locomotive/steam/entities/page.rb', line 47
def not_found?
attributes[:fullpath].values.first == '404'
end
|
#published? ⇒ Boolean
34
|
# File 'lib/locomotive/steam/entities/page.rb', line 34
def published?; !!published; end
|
#redirect? ⇒ Boolean
36
|
# File 'lib/locomotive/steam/entities/page.rb', line 36
def redirect?; redirect.nil? ? !redirect_url.blank? : redirect; end
|
#source ⇒ Object
55
56
57
|
# File 'lib/locomotive/steam/entities/page.rb', line 55
def source
self[:raw_template]
end
|
#templatized? ⇒ Boolean
35
|
# File 'lib/locomotive/steam/entities/page.rb', line 35
def templatized?; !!templatized; end
|