Commit 3e376bd7 by Peter Fogg

Prevent "saved" and "error" views from showing at the same time.

Previously the "saved" view was never hidden, even after more data was
edited. So if one field was saved successfully and then another was
not, we would find ourselves in the unfortunate situation of seeing
both views at once, leading to much confusion.
parent 72e08456
...@@ -21,6 +21,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({ ...@@ -21,6 +21,7 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
} }
); );
this.listenTo(this.model, 'invalid', this.handleValidationError); this.listenTo(this.model, 'invalid', this.handleValidationError);
this.savedBar = undefined;
}, },
render: function() { render: function() {
// catch potential outside call before template loaded // catch potential outside call before template loaded
...@@ -136,15 +137,22 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({ ...@@ -136,15 +137,22 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
success : function() { success : function() {
self.render(); self.render();
var message = gettext("Please note that validation of your policy key and value pairs is not currently in place yet. If you are having difficulties, please review your policy pairs."); var message = gettext("Please note that validation of your policy key and value pairs is not currently in place yet. If you are having difficulties, please review your policy pairs.");
var saving = new CMS.Views.Alert.Confirmation({ self.saved = new CMS.Views.Alert.Confirmation({
title: gettext("Your policy changes have been saved."), title: gettext("Your policy changes have been saved."),
message: message, message: message,
closeIcon: false closeIcon: false
}); });
saving.show(); self.saved.show();
analytics.track('Saved Advanced Settings', { analytics.track('Saved Advanced Settings', {
'course': course_location_analytics 'course': course_location_analytics
}); });
},
error: function() {
// If we've already saved some data this will be
// shown; hide it away again.
if(self.saved) {
self.saved.hide();
}
} }
}); });
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment