Sha256: 28ffcdfc3765c40ada6bb0dd07f051617af9d0b8eece706964dee3e1f205a270

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

if defined?(EffectiveRegions)
  module Effective
    module Snippets
      class EffectiveAsset < Snippet
        # attr_accessor :asset_id     #, Integer
        # attr_accessor :html_class   #, String
        # attr_accessor :link_title   #, String
        # attr_accessor :private_url  # , Boolean

        def snippet_attributes
          super + [:asset_id, :html_class, :link_title, :private_url]
        end

        def asset
          @asset ||= (Effective::Asset.where(:id => asset_id).first if asset_id)
        end

        def snippet_tag
          :span
        end

        def private_url
          super || aws_private?
        end

        def is_private?
          private_url == true
        end

        def aws_private?
          (asset.try(:aws_acl) == EffectiveAssets::AWS_PRIVATE)
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_assets-1.11.0 app/models/effective/snippets/effective_asset.rb