class Locomotive::Wagon::SiteDecorator

Attributes

__base_path__[RW]
__content_assets_pusher__[RW]

Public Class Methods

new(object, locale = nil, base_path = nil, content_assets_pusher = nil) click to toggle source
Calls superclass method
# 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

Public Instance Methods

__attributes__() click to toggle source
# 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() click to toggle source
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 55
def allow_dots_in_slugs
  self[:allow_dots_in_slugs]
end
domains() click to toggle source
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 17
def domains
  (__getobj__.domains || []) - ['localhost']
end
metafields() click to toggle source
# 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
metafields_schema() click to toggle source
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 25
def metafields_schema
  self[:metafields_schema].try(:to_json)
end
metafields_ui() click to toggle source
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 21
def metafields_ui
  self[:metafields_ui].try(:to_json)
end
overwrite_same_content_assets() click to toggle source
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 51
def overwrite_same_content_assets
  self[:overwrite_same_content_assets]
end
picture() click to toggle source
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 42
def picture
  picture_path = __getobj__.picture
  if picture_path && File.exists?(picture_path)
    Locomotive::Coal::UploadIO.new(picture_path, nil, 'icon.png')
  else
    nil
  end
end
routes() click to toggle source
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 38
def routes
  self[:routes]&.to_json
end
sections_content() click to toggle source
Calls superclass method
# File lib/locomotive/wagon/decorators/site_decorator.rb, line 34
def sections_content
  replace_with_content_assets!(super&.to_json)
end