Class: Locomotive::Wagon::SiteDecorator
- Inherits:
-
Steam::Decorators::I18nDecorator
- Object
- Steam::Decorators::I18nDecorator
- Locomotive::Wagon::SiteDecorator
show all
- Includes:
- PersistAssetsConcern, ToHashConcern
- Defined in:
- lib/locomotive/wagon/decorators/site_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 = nil, base_path = nil, content_assets_pusher = nil) ⇒ SiteDecorator
Returns a new instance of SiteDecorator.
11
12
13
14
15
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 11
def initialize(object, locale = nil, base_path = nil, content_assets_pusher = nil)
self.__base_path__ = base_path
self.__content_assets_pusher__ = content_assets_pusher
super(object, locale || object.default_locale, nil)
end
|
Instance Attribute Details
#__base_path__ ⇒ Object
Returns the value of attribute base_path.
9
10
11
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 9
def __base_path__
@__base_path__
end
|
#__content_assets_pusher__ ⇒ Object
Returns the value of attribute content_assets_pusher.
9
10
11
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 9
def __content_assets_pusher__
@__content_assets_pusher__
end
|
Instance Method Details
#__attributes__ ⇒ Object
65
66
67
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 65
def __attributes__
%i(name handle robots_txt locales timezone seo_title meta_keywords meta_description picture metafields_schema metafields metafields_ui asset_host sections_content routes overwrite_same_content_assets allow_dots_in_slugs)
end
|
#allow_dots_in_slugs ⇒ Object
55
56
57
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 55
def allow_dots_in_slugs
self[:allow_dots_in_slugs]
end
|
#domains ⇒ Object
17
18
19
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 17
def domains
(__getobj__.domains || []) - ['localhost']
end
|
29
30
31
32
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 29
def metafields
replace_with_content_assets_in_hash!(self[:metafields])
self[:metafields]&.to_json
end
|
25
26
27
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 25
def metafields_schema
self[:metafields_schema].try(:to_json)
end
|
21
22
23
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 21
def metafields_ui
self[:metafields_ui].try(:to_json)
end
|
#overwrite_same_content_assets ⇒ Object
51
52
53
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 51
def overwrite_same_content_assets
self[:overwrite_same_content_assets]
end
|
#picture ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 42
def picture
picture_path = __getobj__.picture
if picture_path && File.exist?(picture_path)
Locomotive::Coal::UploadIO.new(picture_path, nil, 'icon.png')
else
nil
end
end
|
#routes ⇒ Object
38
39
40
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 38
def routes
self[:routes]&.to_json
end
|
#sections_content ⇒ Object
34
35
36
|
# File 'lib/locomotive/wagon/decorators/site_decorator.rb', line 34
def sections_content
replace_with_content_assets!(super&.to_json)
end
|