diff options
author | Garren Smith <garren.smith@gmail.com> | 2013-11-22 16:56:21 +0200 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2013-11-22 16:56:21 +0200 |
commit | aefd60e89629bb6aa1815f4701c06035545813ce (patch) | |
tree | 69127a29afd319cd69ba8ef5a11b94ea7b52f38c | |
parent | fb98bbcd1c0dd5e39beb2c40b70c97da188ca612 (diff) | |
download | couchdb-aefd60e89629bb6aa1815f4701c06035545813ce.tar.gz |
Fauxton add back update View function
-rw-r--r-- | src/fauxton/app/modules/documents/views.js | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js index 676574f0f..56ce9c6a5 100644 --- a/src/fauxton/app/modules/documents/views.js +++ b/src/fauxton/app/modules/documents/views.js @@ -1193,7 +1193,6 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) { } }, - updateValues: function() { var notification; if (this.model.changedAttributes()) { @@ -1301,6 +1300,43 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) { } }, + updateView: function(event, paramInfo) { + event.preventDefault(); + + if (this.newView) { return alert('Please save this new view before querying it.'); } + + var errorParams = paramInfo.errorParams, + params = paramInfo.params; + + if (_.any(errorParams)) { + _.map(errorParams, function(param) { + + // TODO: Where to add this error? + // bootstrap wants the error on a control-group div, but we're not using that + //$('form.view-query-update input[name='+param+'], form.view-query-update select[name='+param+']').addClass('error'); + return FauxtonAPI.addNotification({ + msg: "JSON Parse Error on field: "+param.name, + type: "error", + selector: ".advanced-options .errors-container" + }); + }); + FauxtonAPI.addNotification({ + msg: "Make sure that strings are properly quoted and any other values are valid JSON structures", + type: "warning", + selector: ".advanced-options .errors-container" + }); + + return false; + } + + var fragment = window.location.hash.replace(/\?.*$/, ''); + fragment = fragment + '?' + $.param(params); + FauxtonAPI.navigate(fragment, {trigger: false}); + + FauxtonAPI.triggerRouteEvent('updateAllDocs', {ddoc: this.ddocID, view: this.viewName}); + }, + + previewView: function(event, paramsInfo) { var that = this, mapVal = this.mapEditor.getValue(), |