Class: Locomotive::ThemeAssetPresenter
Instance Attribute Summary
#ability, #depth
Instance Method Summary
collapse
#ability?, #after_initialize, getters_to_hash, #id, setters_to_hash, #site
#after_initialize, #as_json, #attributes=, #getters, #initialize, #property_options, #setters
Instance Method Details
#can_be_deleted ⇒ Object
43
44
45
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 43
def can_be_deleted
self.ability.try(:can?, :destroy, self.source)
end
|
#content_type ⇒ Object
6
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 6
properties :content_type, :folder
|
#dimensions ⇒ Object
35
36
37
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 35
def dimensions
self.source.image? ? "#{self.source.width}px x #{self.source.height}px" : nil
end
|
#local_path ⇒ Object
other getters / setters ##
19
20
21
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 19
def local_path
self.source.local_path(true)
end
|
#plain_text ⇒ Object
47
48
49
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 47
def plain_text
plain_text? ? self.source.plain_text : nil
end
|
#raw_size ⇒ Object
31
32
33
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 31
def raw_size
self.source.size
end
|
#size ⇒ Object
27
28
29
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 27
def size
number_to_human_size(self.source.size)
end
|
#updated_at ⇒ Object
39
40
41
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 39
def updated_at
I18n.l(self.source.updated_at, :format => :short)
end
|
#url ⇒ Object
23
24
25
|
# File 'app/presenters/locomotive/theme_asset_presenter.rb', line 23
def url
self.source.source.url
end
|