A platform for community discussion. Free, open, simple.
FIX: Should be possible to save an empty theme_field in the editor
David Taylord08939ab0563
diff --git a/app/assets/javascripts/admin/models/theme.js.es6 b/app/assets/javascripts/admin/models/theme.js.es6index 7b2706dff26..d72ac47e4bc 100644--- a/app/assets/javascripts/admin/models/theme.js.es6+++ b/app/assets/javascripts/admin/models/theme.js.es6@@ -60,7 +60,7 @@ const Theme = RestModel.extend({};},- @computed("fieldNames", "[email protected]")+ @computed("fieldNames", "theme_fields.[]", "[email protected]")fields(fieldNames) {const hash = {};Object.keys(fieldNames).forEach(target => {@@ -208,11 +208,15 @@ const Theme = RestModel.extend({this.theme_fields.pushObject(field);themeFields[key] = field;} else {- if (Ember.isEmpty(value)) {- this.theme_fields.removeObject(themeFields[key]);- themeFields[key] = null;- } else {- existingField.value = value;+ const changed =+ (Ember.isEmpty(existingField.value) && !Ember.isEmpty(value)) ||+ (Ember.isEmpty(value) && !Ember.isEmpty(existingField.value));++ existingField.value = value;+ if (changed) {+ // Observing [email protected] is too slow, so manually notify+ // if the value goes to/from blank+ this.notifyPropertyChange("theme_fields.[]");}}},