You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/12/03 16:26:35 UTC

[1/3] git commit: updated refs/heads/master to 862d8ae

Updated Branches:
  refs/heads/master 08cac68b2 -> 862d8ae43


Fauxton: Add preview to edit index and fix preview bug


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

Branch: refs/heads/master
Commit: d2f1ec7af38d57fd248a49ebd64ba7b46b0828ff
Parents: 08cac68
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Dec 3 12:46:19 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Dec 3 17:26:11 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js      | 22 +++++++++++++++++---
 .../app/templates/documents/view_editor.html    |  1 +
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d2f1ec7a/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 ffbc1d1..cf939e2 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -1164,7 +1164,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       "click button.save": "saveView",
       "click button.delete": "deleteView",
       "change select#reduce-function-selector": "updateReduce",
-      
+      "click button.preview": "previewView",
       "click #db-views-tabs-nav": 'toggleIndexNav'
     },
 
@@ -1344,10 +1344,17 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
 
 
     previewView: function(event, paramsInfo) {
+      event.preventDefault();
       var that = this,
-      mapVal = this.mapEditor.getValue(),
+      mapVal = this.mapVal(),
       reduceVal = this.reduceVal(),
-      paramsArr = paramsInfo.params;
+      paramsArr = [];
+
+      console.log(mapVal);
+      
+      if (paramsInfo && paramsInfo.params) {
+        paramsArr = paramsInfo.params;
+      }
 
       var params = _.reduce(paramsArr, function (params, param) {
         params[param.name] = param.value;
@@ -1390,6 +1397,15 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       return $("#reduce-function-selector").val() == "CUSTOM";
     },
 
+    mapVal: function () {
+
+      if (this.mapEditor) {
+        return this.mapEditor.getValue();
+      }
+
+      return this.$('#map-function').text();
+    },
+
     reduceVal: function() {
       var reduceOption = this.$('#reduce-function-selector :selected').val(),
       reduceVal = "";

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d2f1ec7a/src/fauxton/app/templates/documents/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html
index f35b8ab..bb6e0af 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -67,6 +67,7 @@ the License.
 
           <div class="control-group">
             <button class="button green save fonticon-circle-check">Save</button>
+            <button class="button btn-info preview">Preview</button>
             <% if (!this.newView) { %>
             <button class="button delete outlineGray fonticon-circle-x">Delete</button>
             <% } %>


[2/3] git commit: updated refs/heads/master to 862d8ae

Posted by ga...@apache.org.
Fauxton: Remove databases from breadcrumbs


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

Branch: refs/heads/master
Commit: 5825fe61a39c8beecc84e57bd7ef097e6e4cf1b4
Parents: d2f1ec7
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Dec 3 13:07:47 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Dec 3 17:26:12 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/compaction/routes.js  | 1 -
 src/fauxton/app/addons/permissions/routes.js | 1 -
 src/fauxton/app/modules/documents/routes.js  | 8 --------
 3 files changed, 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/5825fe61/src/fauxton/app/addons/compaction/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/compaction/routes.js b/src/fauxton/app/addons/compaction/routes.js
index b7a2ee3..2a33e07 100644
--- a/src/fauxton/app/addons/compaction/routes.js
+++ b/src/fauxton/app/addons/compaction/routes.js
@@ -27,7 +27,6 @@ function(app, FauxtonAPI, Compaction, Databases) {
 
     crumbs: function () {
       return [
-        {"name": "Databases", "link": "/_all_dbs"},
         {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
         {"name": "Compact & Clean", "link": "compact"}
       ];

http://git-wip-us.apache.org/repos/asf/couchdb/blob/5825fe61/src/fauxton/app/addons/permissions/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/permissions/routes.js b/src/fauxton/app/addons/permissions/routes.js
index f6c6587..89c2bd7 100644
--- a/src/fauxton/app/addons/permissions/routes.js
+++ b/src/fauxton/app/addons/permissions/routes.js
@@ -51,7 +51,6 @@ function (app, FauxtonAPI, Databases, Permissions) {
 
     crumbs: function () {
       return [
-        {"name": "Databases", "link": "/_all_dbs"},
         {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
         {"name": "Permissions", "link": "/permissions"}
       ];

http://git-wip-us.apache.org/repos/asf/couchdb/blob/5825fe61/src/fauxton/app/modules/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/routes.js b/src/fauxton/app/modules/documents/routes.js
index fae5c5c..dc59f3f 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -59,7 +59,6 @@ function(app, FauxtonAPI, Documents, Databases) {
 
     crumbs: function() {
       return [
-        {"name": "Databases", "link": "/_all_dbs"},
         {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
         {"name": this.docID, "link": "#"}
       ];
@@ -129,7 +128,6 @@ function(app, FauxtonAPI, Documents, Databases) {
     },
     crumbs: function() {
       return [
-        {"name": "Databases", "link": "/_all_dbs"},
         {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
         {"name": "New", "link": "#"}
       ];
@@ -220,7 +218,6 @@ function(app, FauxtonAPI, Documents, Databases) {
       }));
 
       this.crumbs = [
-        {"name": "Databases", "link": "/_all_dbs"},
         {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)}
       ];
 
@@ -269,9 +266,7 @@ function(app, FauxtonAPI, Documents, Databases) {
 
       this.crumbs = function () {
         return [
-          {"name": "Databases", "link": "/_all_dbs"},
           {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)},
-          {"name": ddoc + "/" + view, "link": this.data.indexedDocs.url()}
         ];
       };
 
@@ -291,9 +286,7 @@ function(app, FauxtonAPI, Documents, Databases) {
       this.sidebar.setSelectedTab('new-view');
       this.crumbs = function () {
         return [
-          {"name": "Databases", "link": "/_all_dbs"},
           {"name": this.data.database.id, "link": Databases.databaseUrl(this.data.database)},
-          {"name": "new"}
         ];
       };
     },
@@ -377,7 +370,6 @@ function(app, FauxtonAPI, Documents, Databases) {
     selectedHeader: "Databases",
     crumbs: function () {
       return [
-        {"name": "Databases", "link": "/_all_dbs"},
         {"name": this.database.id, "link": Databases.databaseUrl(this.database)},
         {"name": "_changes", "link": "/_changes"}
       ];


[3/3] git commit: updated refs/heads/master to 862d8ae

Posted by ga...@apache.org.
Fauxton: hide reduce options for no reduce


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

Branch: refs/heads/master
Commit: 862d8ae43ff1f44e910669031945b40c6073a01a
Parents: 5825fe6
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Dec 3 16:54:12 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Dec 3 17:26:12 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js | 28 ++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/862d8ae4/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 cf939e2..1fe4cb7 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -965,10 +965,11 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       this.viewName = options.viewName;
       this.updateViewFn = options.updateViewFn;
       this.previewFn = options.previewFn;
-      this.hadReduce = options.hasReduce || true;
+      //this.hadReduce = options.hasReduce || true;
 
       if (typeof(options.hasReduce) === 'undefined') {
         this.hasReduce = true;
+        console.log('set true');
       } else {
         this.hasReduce = options.hasReduce;
       }
@@ -997,6 +998,11 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       }
     },
 
+    renderOnUpdatehasReduce: function (hasReduce) {
+      this.hasReduce = hasReduce;
+      this.render();
+    },
+
     queryParams: function () {
       var $form = this.$(".view-query-update");
       // Ignore params without a value
@@ -1216,6 +1222,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       var $reduceContainer = $(".control-group.reduce-function");
       if ($ele.val() == "CUSTOM") {
         this.createReduceEditor();
+        this.reduceEditor.setValue(this.langTemplates.javascript.reduce);
         $reduceContainer.show();
       } else {
         $reduceContainer.hide();
@@ -1286,6 +1293,11 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
             that.newView = false;
           }
 
+          if (that.reduceFunStr !== reduceVal) {
+            that.reduceFunStr = reduceVal;
+            that.advancedOptions.renderOnUpdatehasReduce(that.hasReduce()); 
+          }
+
           FauxtonAPI.triggerRouteEvent('updateAllDocs', {ddoc: ddocName, view: viewName});
 
         }, function(xhr) {
@@ -1350,8 +1362,6 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       reduceVal = this.reduceVal(),
       paramsArr = [];
 
-      console.log(mapVal);
-      
       if (paramsInfo && paramsInfo.params) {
         paramsArr = paramsInfo.params;
       }
@@ -1398,7 +1408,6 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
     },
 
     mapVal: function () {
-
       if (this.mapEditor) {
         return this.mapEditor.getValue();
       }
@@ -1419,6 +1428,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       return reduceVal;
     },
 
+
     hasValidCode: function() {
       return _.every(["mapEditor", "reduceEditor"], function(editorName) {
         var editor = this[editorName];
@@ -1456,7 +1466,6 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
         ddocName: this.model.id,
         viewName: this.viewName,
         reduceFunStr: this.reduceFunStr,
-        hasReduce: this.reduceFunStr,
         isCustomReduce: this.hasCustomReduce(),
         newView: this.newView,
         langTemplates: this.langTemplates.javascript
@@ -1467,6 +1476,10 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
       return this.reduceFunStr && ! _.contains(this.builtinReduces, this.reduceFunStr);
     },
 
+    hasReduce: function () {
+      return this.reduceFunStr || false;
+    },
+
     createReduceEditor: function () {
       if (this.reduceEditor) {
         this.reduceEditor.remove();
@@ -1501,13 +1514,14 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, resizeColumns) {
         ddocName: this.model.id,
         database: this.database
       }));
-
+      
       this.advancedOptions = this.insertView('#query', new Views.AdvancedOptions({
         updateViewFn: this.updateView,
         previewFn: this.previewView,
         database: this.database,
         viewName: this.viewName,
-        ddocName: this.model.id
+        ddocName: this.model.id,
+        hasReduce: this.hasReduce
       }));
     },