You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by dc...@apache.org on 2014/03/16 17:58:03 UTC

[23/29] couchdb commit: updated refs/heads/2041-update-ibrowse to b63f393

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/d2a3c3c0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d2a3c3c0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d2a3c3c0

Branch: refs/heads/2041-update-ibrowse
Commit: d2a3c3c09869954dbb3cabbd4543c036e55412f0
Parents: 4f7cb15
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 14:04:00 2014 -0400

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d2a3c3c0/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..699a496 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,
@@ -273,20 +267,20 @@ function(app, FauxtonAPI, Documents, Databases) {
         params: urlParams,
         newView: false,
         database: this.data.database,
-        ddocInfo: ddocInfo
+        ddocInfo: this.ddocInfo(decodeDdoc, this.data.designDocs, view)
       }));
 
       if (this.toolsView) { this.toolsView.remove(); }
 
-      this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
+      this.documentsView = this.createViewDocumentsView({
+        designDoc: decodeDdoc,
+        docParams: docParams, 
+        urlParams: urlParams,
         database: this.data.database,
-        collection: this.data.indexedDocs,
-        nestedView: Documents.Views.Row,
-        viewList: true,
-        ddocInfo: ddocInfo,
-        docParams: docParams,
-        params: urlParams
-      }));
+        indexedDocs: this.data.indexedDocs,
+        designDocs: this.data.designDocs,
+        view: view
+      });
 
       this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc) + '_' + app.utils.removeSpecialCharacters(view));
 
@@ -300,6 +294,27 @@ function(app, FauxtonAPI, Documents, Databases) {
       Documents.paginate.reset();
     },
 
+    ddocInfo: function (designDoc, designDocs, view) {
+      return {
+        id: "_design/" + designDoc,
+        currView: view,
+        designDocs: designDocs
+      };
+    },
+
+    createViewDocumentsView: function (options) { 
+
+      return this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
+        database: options.database,
+        collection: options.indexedDocs,
+        nestedView: Documents.Views.Row,
+        viewList: true,
+        ddocInfo: this.ddocInfo(options.designDoc, options.designDocs, options.view),
+        docParams: options.docParams,
+        params: options.urlParams
+      }));
+    },
+
     newViewEditor: function () {
       var params = app.getParams();
 
@@ -347,6 +362,17 @@ function(app, FauxtonAPI, Documents, Databases) {
           params: docParams
         });
 
+        if (!this.documentsView) {
+          this.documentsView = this.createViewDocumentsView({
+            designDoc: ddoc,
+            docParams: docParams, 
+            urlParams: urlParams,
+            database: this.data.database,
+            indexedDocs: this.indexedDocs,
+            designDocs: this.data.designDocs,
+            view: view
+          });
+        }
       }
 
       this.documentsView.setCollection(collection);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/d2a3c3c0/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();