Class: Locomotive::ThemeAssetPresenter
Instance Attribute Summary
#__ability, #__depth
Instance Method Summary
collapse
#_id, #ability?, #after_initialize, #errors, #formatted_time, getters_or_setters_to_hash, getters_to_hash, #html_view?, #include_errors?, setters_to_hash, #site, #true
#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, :checksum
|
#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
|