2011-10-30 23:02:41 +00:00
|
|
|
module Locomotive
|
|
|
|
class EditableShortText < EditableElement
|
|
|
|
|
|
|
|
## fields ##
|
2012-01-25 21:07:10 +00:00
|
|
|
field :content, :localize => true
|
2011-10-30 23:02:41 +00:00
|
|
|
|
|
|
|
## methods ##
|
|
|
|
|
2012-01-25 21:07:10 +00:00
|
|
|
def content_with_localization
|
|
|
|
value = self.content_without_localization
|
|
|
|
value.blank? ? self.default_content : value
|
2011-10-30 23:02:41 +00:00
|
|
|
end
|
|
|
|
|
2012-01-25 21:07:10 +00:00
|
|
|
alias_method_chain :content, :localization
|
|
|
|
|
2011-11-21 01:27:05 +00:00
|
|
|
def as_json(options = {})
|
|
|
|
Locomotive::EditableShortTextPresenter.new(self).as_json
|
|
|
|
end
|
|
|
|
|
2011-10-30 23:02:41 +00:00
|
|
|
end
|
|
|
|
end
|