Class: Effective::Snippets::EffectiveAsset
- Inherits:
-
Snippet
- Object
- Snippet
- Effective::Snippets::EffectiveAsset
show all
- Defined in:
- app/models/effective/snippets/effective_asset.rb
Instance Method Summary
collapse
Methods inherited from Snippet
all, #class_name, #data, definitions, #id, #initialize, #region, #snippet_description, #snippet_dialog_url, #snippet_editables, #snippet_inline, #snippet_label, #to_partial_path
Instance Method Details
#asset ⇒ Object
13
14
15
16
|
# File 'app/models/effective/snippets/effective_asset.rb', line 13
def asset
return nil unless defined?(Effective::Asset)
@asset ||= (Effective::Asset.where(:id => asset_id).first if asset_id)
end
|
#aws_private? ⇒ Boolean
30
31
32
|
# File 'app/models/effective/snippets/effective_asset.rb', line 30
def aws_private?
asset.try(:aws_acl) == 'authenticated-read'
end
|
#is_private? ⇒ Boolean
26
27
28
|
# File 'app/models/effective/snippets/effective_asset.rb', line 26
def is_private?
[true, 'true', '1'].include?(private_url)
end
|
#private_url ⇒ Object
22
23
24
|
# File 'app/models/effective/snippets/effective_asset.rb', line 22
def private_url
super || aws_private?
end
|
#snippet_attributes ⇒ Object
attr_accessor :asset_id #, Integer attr_accessor :html_class #, String attr_accessor :link_title #, String attr_accessor :private_url # , Boolean
9
10
11
|
# File 'app/models/effective/snippets/effective_asset.rb', line 9
def snippet_attributes
super + [:asset_id, :html_class, :link_title, :private_url]
end
|
#snippet_tag ⇒ Object
18
19
20
|
# File 'app/models/effective/snippets/effective_asset.rb', line 18
def snippet_tag
:span
end
|