Updated Branches:
  refs/heads/master fb98bbcd1 -> aefd60e89

Fauxton add back update View function


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/aefd60e8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/aefd60e8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/aefd60e8

Branch: refs/heads/master
Commit: aefd60e89629bb6aa1815f4701c06035545813ce
Parents: fb98bbc
Author: Garren Smith <[email protected]>
Authored: Fri Nov 22 16:56:21 2013 +0200
Committer: Garren Smith <[email protected]>
Committed: Fri Nov 22 16:56:21 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js | 38 ++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/aefd60e8/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index 676574f..56ce9c6 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(),

Reply via email to