diff options
author | Garren Smith <garren.smith@gmail.com> | 2014-03-13 10:01:31 -0400 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2014-03-13 14:04:00 -0400 |
commit | d2a3c3c09869954dbb3cabbd4543c036e55412f0 (patch) | |
tree | 1964841ff6fe7dd3cd051b9dc2f6e8b6b253b7ff | |
parent | 4f7cb15959898e202fa3780d3bcf35a78e297fbc (diff) | |
download | couchdb-d2a3c3c09869954dbb3cabbd4543c036e55412f0.tar.gz |
Fauxton new view creation fix
Fixes issue COUCHDB-2201
-rw-r--r-- | src/fauxton/app/addons/documents/routes.js | 58 | ||||
-rw-r--r-- | src/fauxton/app/addons/documents/views.js | 2 |
2 files changed, 44 insertions, 16 deletions
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js index ff518e4c6..699a496ba 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); diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js index 48075e802..56e991183 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(); |