diff options
author | Garren Smith <garren.smith@gmail.com> | 2014-03-13 13:51:50 -0400 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2014-03-13 13:51:50 -0400 |
commit | cc3c373491f4ed0a48412de9136cf6f485dd379d (patch) | |
tree | 1964841ff6fe7dd3cd051b9dc2f6e8b6b253b7ff | |
parent | 0f4b7c65b23725d6f691e92d8053997b13758f8b (diff) | |
download | couchdb-2201-fix-new-view.tar.gz |
create options argument2201-fix-new-view
-rw-r--r-- | src/fauxton/app/addons/documents/routes.js | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js index c7730df06..699a496ba 100644 --- a/src/fauxton/app/addons/documents/routes.js +++ b/src/fauxton/app/addons/documents/routes.js @@ -267,18 +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.createViewDocumentsView( - decodeDdoc, - docParams, - urlParams, - this.data.database, - this.indexedDocs, - this.data.designDocs); + this.documentsView = this.createViewDocumentsView({ + designDoc: decodeDdoc, + docParams: docParams, + urlParams: urlParams, + database: this.data.database, + indexedDocs: this.data.indexedDocs, + designDocs: this.data.designDocs, + view: view + }); this.sidebar.setSelectedTab(app.utils.removeSpecialCharacters(ddoc) + '_' + app.utils.removeSpecialCharacters(view)); @@ -292,21 +294,24 @@ function(app, FauxtonAPI, Documents, Databases) { Documents.paginate.reset(); }, - createViewDocumentsView: function (designDoc, docParams, urlParams, database, indexedDocs, designDocs) { - var ddocInfo = { + ddocInfo: function (designDoc, designDocs, view) { + return { id: "_design/" + designDoc, currView: view, - designDocs: this.data.designDocs + designDocs: designDocs }; + }, + + createViewDocumentsView: function (options) { return this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({ - database: database, - collection: indexedDocs, + database: options.database, + collection: options.indexedDocs, nestedView: Documents.Views.Row, viewList: true, - ddocInfo: ddocInfo, - docParams: docParams, - params: urlParams + ddocInfo: this.ddocInfo(options.designDoc, options.designDocs, options.view), + docParams: options.docParams, + params: options.urlParams })); }, @@ -358,13 +363,15 @@ function(app, FauxtonAPI, Documents, Databases) { }); if (!this.documentsView) { - this.documentsView = this.createViewDocumentsView( - ddoc, - docParams, - urlParams, - this.data.database, - this.indexedDocs, - this.data.designDocs); + this.documentsView = this.createViewDocumentsView({ + designDoc: ddoc, + docParams: docParams, + urlParams: urlParams, + database: this.data.database, + indexedDocs: this.indexedDocs, + designDocs: this.data.designDocs, + view: view + }); } } |