Class: Locomotive::Wagon::PageDecorator
- Inherits:
-
Steam::Decorators::TemplateDecorator
- Object
- Steam::Decorators::TemplateDecorator
- Locomotive::Wagon::PageDecorator
show all
- Includes:
- PersistAssetsConcern, ToHashConcern
- Defined in:
- lib/locomotive/wagon/decorators/page_decorator.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#asset_io, #replace_with_content_assets!, #replace_with_content_assets_in_hash!
#prepare_value_for_hash, #to_hash
Constructor Details
#initialize(object, locale, content_assets_pusher, persist_content) ⇒ PageDecorator
Returns a new instance of PageDecorator.
11
12
13
14
15
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 11
def initialize(object, locale, content_assets_pusher, persist_content)
self.__content_assets_pusher__ = content_assets_pusher
self.__persist_content__ = persist_content
super(object, locale, nil) end
|
Instance Attribute Details
#__content_assets_pusher__ ⇒ Object
Returns the value of attribute content_assets_pusher.
9
10
11
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 9
def __content_assets_pusher__
@__content_assets_pusher__
end
|
#__persist_content__ ⇒ Object
Returns the value of attribute persist_content.
9
10
11
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 9
def __persist_content__
@__persist_content__
end
|
Instance Method Details
#__attributes__ ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 17
def __attributes__
_attributes = %i(title slug parent
handle response_type published
position listed
is_layout allow_layout
redirect_url redirect_type
seo_title meta_keywords meta_description
editable_elements
sections_dropzone_content
sections_content
content_type
template
display_settings)
if persisted? && !__persist_content__
_attributes -= %i(title published listed position seo_title meta_keywords meta_description editable_elements sections_dropzone_content sections_content)
end
_attributes -= %i(slug) if persisted?
_attributes
end
|
#_id ⇒ Object
48
49
50
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 48
def _id
__getobj__[:remote_id]
end
|
#_id=(id) ⇒ Object
44
45
46
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 44
def _id=(id)
__getobj__[:remote_id] = id
end
|
#allow_layout ⇒ Object
60
61
62
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 60
def allow_layout
self[:allow_layout]
end
|
#content_type ⇒ Object
76
77
78
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 76
def content_type
templatized? ? content_type_id : nil
end
|
#display_settings ⇒ Object
72
73
74
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 72
def display_settings
self[:display_settings]
end
|
#editable_elements ⇒ Object
80
81
82
83
84
85
86
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 80
def editable_elements
return nil if __getobj__.editable_elements.all.count == 0
__getobj__.editable_elements.all.map do |element|
EditableElementDecorator.new(element, __locale__, __content_assets_pusher__)
end
end
|
#folder_path ⇒ Object
100
101
102
103
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 100
def folder_path
*segments, slug = fullpath.split('/')
segments.join('/')
end
|
#is_layout ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 52
def is_layout
if self[:is_layout].nil?
!(__getobj__._fullpath =~ %r(^layouts/)).nil?
else
self[:is_layout]
end
end
|
#parent ⇒ Object
68
69
70
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 68
def parent
self[:parent]
end
|
#response_type ⇒ Object
64
65
66
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 64
def response_type
self[:response_type]
end
|
#sections_content ⇒ Object
92
93
94
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 92
def sections_content
replace_with_content_assets!(super&.to_json)
end
|
#sections_dropzone_content ⇒ Object
88
89
90
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 88
def sections_dropzone_content
replace_with_content_assets!(super&.to_json)
end
|
#template ⇒ Object
96
97
98
|
# File 'lib/locomotive/wagon/decorators/page_decorator.rb', line 96
def template
replace_with_content_assets!(self.liquid_source)
end
|