Class: Locomotive::EditableFile
- Inherits:
-
EditableElement
- Object
- EditableElement
- Locomotive::EditableFile
- Defined in:
- app/models/locomotive/editable_file.rb
Instance Attribute Summary
Attributes inherited from EditableElement
#block_name, #block_priority, #label
Instance Method Summary collapse
-
#content ⇒ String
Returns the url or the path to the uploaded file if it exists.
-
#default_source_url ⇒ Object
fields ##.
- #remove_source=(value) ⇒ Object
-
#source ⇒ Object
behaviours ##.
Methods inherited from EditableElement
#_type, #add_current_locale, #block_label, #by_priority, #disabled?, #page, #page_id, #path, #slug
Instance Method Details
#content ⇒ String
Note:
This method is not used for the rendering, only for the back-office
Returns the url or the path to the uploaded file if it exists. Otherwise returns the default url.
25 26 27 |
# File 'app/models/locomotive/editable_file.rb', line 25 def content self.source? ? self.source.url : self.default_source_url end |
#default_source_url ⇒ Object
fields ##
10 |
# File 'app/models/locomotive/editable_file.rb', line 10 field :default_source_url, localize: true |
#remove_source=(value) ⇒ Object
31 32 33 34 |
# File 'app/models/locomotive/editable_file.rb', line 31 def remove_source=(value) self.source_will_change! # notify the page to run the callbacks for that element super end |
#source ⇒ Object
behaviours ##
5 |
# File 'app/models/locomotive/editable_file.rb', line 5 mount_uploader 'source', EditableFileUploader |