Skip to content

Commit 85d1d6d

Browse files
committed
fix a case where editable text content set by the API (YAML header) were disappearing in the UI
1 parent cf4855f commit 85d1d6d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/models/locomotive/editable_text.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ class EditableText < EditableElement
1414

1515
## methods ##
1616

17+
# Change the content of the editable element if the value is a new version.
18+
# This method has been overridden for 2 reasons:
19+
# - we have to register the current locale (localized site)
20+
# - the default_content attribute has to be turned off
21+
#
22+
# Called by:
23+
# - the API: page with a YAML header defining the initial content for this editable element
24+
# - the UI: if the content is the same as the default one or the previous one, don't do anything.
1725
def content=(value)
1826
return if value == self.content
1927
self.add_current_locale
20-
self.default_content = false unless self.new_record?
28+
self.default_content = false
2129
super
2230
end
2331

0 commit comments

Comments
 (0)