From e9bb5eb1d0c6052ce4b716d3d0ed8fc8d75f7276 Mon Sep 17 00:00:00 2001 From: cahrens Date: Mon, 11 Feb 2013 17:27:39 -0500 Subject: [PATCH] Minor updates. --- cms/static/js/views/settings/advanced_view.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cms/static/js/views/settings/advanced_view.js b/cms/static/js/views/settings/advanced_view.js index a3bf0d578c..0c8db9b686 100644 --- a/cms/static/js/views/settings/advanced_view.js +++ b/cms/static/js/views/settings/advanced_view.js @@ -87,8 +87,9 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({ } } else { - // This is the case of the page first rendering. + // This is the case of the page first rendering, or when Cancel is pressed. this.hideSaveCancelButtons(); + this.toggleNewButton(true); } }, @@ -171,7 +172,6 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({ // That is, it doesn't change as the val changes until val is accepted. var oldKey = $(event.currentTarget).closest('.key').attr('id'); var newKey = $(event.currentTarget).val(); - console.log('update ', oldKey, newKey); // TODO: REMOVE ME if (oldKey !== newKey) { // TODO: is it OK to erase other validation messages? this.clearValidationErrors(); @@ -179,10 +179,9 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({ if (!this.validateKey(oldKey, newKey)) return; if (this.model.has(newKey)) { - console.log('dupe key'); var error = {}; - error[oldKey] = newKey + " has another entry"; - error[newKey] = "Other entry for " + newKey; + error[oldKey] = 'You have already defined "' + newKey + '" in the manual policy definitions.'; + error[newKey] = "You tried to enter a duplicate of this key."; this.model.trigger("error", this.model, error); return false; } @@ -195,7 +194,6 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({ var validation = this.model.validate(newEntryModel); if (validation) { - console.log('reserved key'); if (_.has(validation, newKey)) { // swap to the key which the map knows about validation[oldKey] = validation[newKey]; @@ -242,7 +240,6 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({ // model validation can't handle malformed keys nor notice if 2 fields have same key; so, need to add that chk here // TODO ensure there's no spaces or illegal chars if (_.isEmpty(newKey)) { - console.log('no key'); var error = {}; error[oldKey] = "Key cannot be an empty string"; this.model.trigger("error", this.model, error);