couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [25/50] [abbrv] fauxton commit: updated refs/heads/import-master to b32c617
Date Tue, 01 Apr 2014 09:14:41 GMT
Fauxton new view creation fix

Fixes issue COUCHDB-2201


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

Branch: refs/heads/import-master
Commit: b7092458d9643f115bcb9e93b4cba43456cb32ce
Parents: f791b02
Author: Garren Smith <garren.smith@gmail.com>
Authored: Thu Mar 13 10:01:31 2014 -0400
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Thu Mar 13 14:04:00 2014 -0400

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


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b7092458/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index ff518e4..699a496 100644
--- a/app/addons/documents/routes.js
+++ b/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-fauxton/blob/b7092458/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js
index 48075e8..56e9911 100644
--- a/app/addons/documents/views.js
+++ b/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();
 


Mime
View raw message