Class: Locomotive::ContentAssetPresenter
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
#content_type ⇒ Object
6
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 6
properties :content_type, :width, :height
|
#content_type_text ⇒ Object
33
34
35
36
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 33
def content_type_text
value = self.__source.content_type.to_s == 'other' ? self.extname : self.__source.content_type
value.blank? ? '?' : value
end
|
#extname ⇒ Object
29
30
31
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 29
def extname
truncate(self.__source.extname, length: 3)
end
|
#filename ⇒ Object
21
22
23
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 21
def filename
truncate(self.__source.source_filename, length: 22)
end
|
#full_filename ⇒ Object
custom getters / setters ##
17
18
19
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 17
def full_filename
self.__source.source_filename
end
|
#raw_size ⇒ Object
38
39
40
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 38
def raw_size
self.__source.size
end
|
#short_name ⇒ Object
25
26
27
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 25
def short_name
truncate(self.__source.name, length: 15)
end
|
#url ⇒ Object
42
43
44
|
# File 'app/presenters/locomotive/content_asset_presenter.rb', line 42
def url
self.__source.source.url
end
|