Class: Locomotive::EditableFilePresenter
- Inherits:
-
EditableElementPresenter
- Object
- BasePresenter
- EditableElementPresenter
- Locomotive::EditableFilePresenter
- Defined in:
- app/presenters/locomotive/editable_file_presenter.rb
Instance Attribute Summary
Attributes inherited from BasePresenter
Instance Method Summary collapse
-
#filename ⇒ Object
other getters / setters ##.
- #source=(value) ⇒ Object
- #source_url=(url) ⇒ Object
-
#true ⇒ Object
properties ##.
- #url ⇒ Object
Methods inherited from EditableElementPresenter
#block_name, #label, #slug, #type
Methods inherited from BasePresenter
#_id, #ability?, #after_initialize, #errors, #formatted_time, getters_or_setters_to_hash, getters_to_hash, #html_view?, #include_errors?, setters_to_hash, #site
Methods included from Presentable
#after_initialize, #as_json, #attributes=, #getters, #initialize, #property_options, #setters
Instance Method Details
#filename ⇒ Object
other getters / setters ##
19 20 21 |
# File 'app/presenters/locomotive/editable_file_presenter.rb', line 19 def filename self.content ? File.basename(self.content) : nil end |
#source=(value) ⇒ Object
27 28 29 |
# File 'app/presenters/locomotive/editable_file_presenter.rb', line 27 def source=(value) self.__source.source = value end |
#source_url=(url) ⇒ Object
31 32 33 |
# File 'app/presenters/locomotive/editable_file_presenter.rb', line 31 def source_url=(url) self.__source.remote_source_url = url end |
#true ⇒ Object
properties ##
6 7 8 9 10 |
# File 'app/presenters/locomotive/editable_file_presenter.rb', line 6 only_getter: true do |presenter| presenter.property :content, description: 'The default url if no uploaded file' presenter.property :url, description: 'Alias for content' presenter.property :filename end |
#url ⇒ Object
23 24 25 |
# File 'app/presenters/locomotive/editable_file_presenter.rb', line 23 def url self.content end |