Sha256: 4a606438d13e08aebac20c7825f89fc7bb1d2b6b1d6fba30aa942cfe02a2fa62

Contents?: true

Size: 941 Bytes

Versions: 9

Compression:

Stored size: 941 Bytes

Contents

module Locomotive
  module Wagon

    class SiteDecorator < SimpleDelegator

      include ToHashConcern

      def domains
        (__getobj__.domains || []) - ['localhost']
      end

      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

      %i(robots_txt timezone seo_title meta_keywords meta_description).each do |name|
        define_method(name) do
          self[name]
        end
      end

      def __attributes__
        %i(name handle robots_txt locales timezone seo_title meta_keywords meta_description picture)
      end

      def edited?
        (self[:content_version].try(:to_i) || 0) > 0
      end

    end

    class UpdateSiteDecorator < SiteDecorator

      def __attributes__
        %i(picture locales)
      end

    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
locomotivecms_wagon-2.0.0 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc8 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc7 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc6 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc5 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc4 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc3 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc2 lib/locomotive/wagon/decorators/site_decorator.rb
locomotivecms_wagon-2.0.0.rc1 lib/locomotive/wagon/decorators/site_decorator.rb