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 2014/03/13 15:02:15 UTC

couchdb commit: updated refs/heads/2201-fix-new-view to e697b33

Repository: couchdb
Updated Branches:
  refs/heads/2201-fix-new-view [created] e697b330b


Fauxton new view creation fix

Fixes issue COUCHDB-2201


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

Branch: refs/heads/2201-fix-new-view
Commit: e697b330bea0d436594fcda2f70e16d9c096b5ec
Parents: 0e33059
Author: Garren Smith <ga...@gmail.com>
Authored: Thu Mar 13 10:01:31 2014 -0400
Committer: Garren Smith <ga...@gmail.com>
Committed: Thu Mar 13 10:01:31 2014 -0400

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/routes.js | 51 +++++++++++++++++--------
 src/fauxton/app/addons/documents/views.js  |  2 +
 2 files changed, 37 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e697b330/src/fauxton/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js
index ff518e4..67589d4 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -259,13 +259,7 @@ function(app, FauxtonAPI, Documents, Databases) {
         view: view,
         params: docParams
       });
-
-      var ddocInfo = {
-        id: "_design/" + decodeDdoc,
-        currView: view,
-        designDocs: this.data.designDocs
-      };
-
+     
       this.viewEditor = this.setView("#dashboard-upper-content", new Documents.Views.ViewEditor({
         model: this.data.database,
         ddocs: this.data.designDocs,
@@ -278,15 +272,13 @@ function(app, FauxtonAPI, Documents, Databases) {
 
       if (this.toolsView) { this.toolsView.remove(); }
 
-      this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
-        database: this.data.database,
-        collection: this.data.indexedDocs,
-        nestedView: Documents.Views.Row,
-        viewList: true,
-        ddocInfo: ddocInfo,
-        docParams: docParams,
-        params: urlParams
-      }));
+      this.documentsView = this.createViewDocumentsView(
+        decodeDdoc,
+        docParams, 
+        urlParams,
+        this.data.database,
+        this.indexedDocs,
+        this.data.designDocs);
 
       this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc) + '_' + app.utils.removeSpecialCharacters(view));
 
@@ -300,6 +292,24 @@ function(app, FauxtonAPI, Documents, Databases) {
       Documents.paginate.reset();
     },
 
+    createViewDocumentsView: function (designDoc, docParams, urlParams, database, indexedDocs, designDocs) {
+       var ddocInfo = {
+        id: "_design/" + designDocs,
+        currView: view,
+        designDocs: this.data.designDocs
+      };
+
+      return this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
+        database: database,
+        collection: indexedDocs,
+        nestedView: Documents.Views.Row,
+        viewList: true,
+        ddocInfo: ddocInfo,
+        docParams: docParams,
+        params: urlParams
+      }));
+    },
+
     newViewEditor: function () {
       var params = app.getParams();
 
@@ -347,6 +357,15 @@ function(app, FauxtonAPI, Documents, Databases) {
           params: docParams
         });
 
+        if (!this.documentsView) {
+          this.documentsView = this.createViewDocumentsView(
+            ddoc,
+            docParams, 
+            urlParams,
+            this.data.database,
+            this.indexedDocs,
+            this.data.designDocs);
+        }
       }
 
       this.documentsView.setCollection(collection);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e697b330/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index 48075e8..56e9911 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -1639,6 +1639,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
       if(this.ddocInfoView){
         this.ddocInfoView.remove();
       } 
+
+      if (this.newView) { return; }
       this.ddocInfoView = this.setView('#ddoc-info', new Views.DdocInfo({model: this.ddocInfo }));
       this.ddocInfoView.render();