diff options
author | Garren Smith <garren.smith@gmail.com> | 2014-03-20 18:35:43 +0200 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2014-03-20 18:35:43 +0200 |
commit | b0f03e712a522468f6388865f763768769e9e16f (patch) | |
tree | 11a1c66442b7a6b74d1956b987dd8ec957aac2e6 | |
parent | 3a009855fd0a6543f7d48eac3f913150bbb6695b (diff) | |
download | couchdb-b0f03e712a522468f6388865f763768769e9e16f.tar.gz |
Seperate error messages for keysQuery-Options-UI
-rw-r--r-- | src/fauxton/app/addons/documents/views.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index bba23af32..cc23e195e 100644 --- a/src/fauxton/app/addons/documents/views.js +++ b/src/fauxton/app/addons/documents/views.js @@ -1142,17 +1142,26 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum }, validateKeys: function(param){ - var parsedValue = this.parseJSON(param.value); - if (_.isUndefined(parsedValue) || !_.isArray(parsedValue)) { + var errorMsg = false, + parsedValue = this.parseJSON(param.value); + + if (_.isUndefined(parsedValue)) { + errorMsg = "Keys must be valid json."; + } else if (!_.isArray(parsedValue)) { + errorMsg = "Keys values must be in an array. E.g [1,2,3]"; + } + + if (errorMsg) { this.$('.js-keys-error').empty(); FauxtonAPI.addNotification({ type: "error", - msg: "Keys values must be in an array. E.g [1,2,3]", + msg: errorMsg, clear: false, selector: '.js-keys-error' }); return false; } + return true; }, queryParams: function () { |