create options argument
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/cc3c3734 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/cc3c3734 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/cc3c3734 Branch: refs/heads/2201-fix-new-view Commit: cc3c373491f4ed0a48412de9136cf6f485dd379d Parents: 0f4b7c6 Author: Garren Smith <[email protected]> Authored: Thu Mar 13 13:51:50 2014 -0400 Committer: Garren Smith <[email protected]> Committed: Thu Mar 13 13:51:50 2014 -0400 ---------------------------------------------------------------------- src/fauxton/app/addons/documents/routes.js | 53 ++++++++++++++----------- 1 file changed, 30 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/cc3c3734/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 c7730df..699a496 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 + }); } }
