2011-10-30 23:02:41 +00:00
|
|
|
module Locomotive
|
|
|
|
class EditableFile < EditableElement
|
|
|
|
|
2011-11-10 21:41:20 +00:00
|
|
|
mount_uploader :source, EditableFileUploader, :mount_on => :source_filename
|
2011-10-30 23:02:41 +00:00
|
|
|
|
|
|
|
def content
|
|
|
|
self.source? ? self.source.url : self.default_content
|
|
|
|
end
|
|
|
|
|
2011-11-21 01:27:05 +00:00
|
|
|
def as_json(options = {})
|
|
|
|
Locomotive::EditableFilePresenter.new(self).as_json
|
|
|
|
end
|
|
|
|
|
2011-10-30 23:02:41 +00:00
|
|
|
end
|
|
|
|
end
|