Repository: couchdb-fauxton Updated Branches: refs/heads/master 9ab1292d4 -> 3c2970514
documents: remove remaining backbone wrapper - remove wrapper for the react headerbar - remove wrapper for footer PR: #406 PR-URL: https://github.com/apache/couchdb-fauxton/pull/406 Reviewed-By: garren smith <[email protected]> Reviewed-By: Michelle Phung <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/3c297051 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/3c297051 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/3c297051 Branch: refs/heads/master Commit: 3c297051466573b318551b2b99e7407efb430a47 Parents: 9ab1292 Author: Robert Kowalski <[email protected]> Authored: Tue May 12 17:37:18 2015 +0200 Committer: Robert Kowalski <[email protected]> Committed: Wed May 13 11:39:57 2015 +0200 ---------------------------------------------------------------------- .../components/react-components.react.jsx | 1 - app/addons/documents/header/header.react.jsx | 6 ---- .../documents/pagination/pagination.react.jsx | 7 +--- app/addons/documents/routes-documents.js | 31 +++++++++-------- app/addons/documents/routes-index-editor.js | 8 +++-- app/addons/documents/routes-mango.js | 10 ++++-- app/addons/documents/views.js | 35 +------------------- 7 files changed, 31 insertions(+), 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3c297051/app/addons/components/react-components.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/components/react-components.react.jsx b/app/addons/components/react-components.react.jsx index 3830073..79abc1c 100644 --- a/app/addons/components/react-components.react.jsx +++ b/app/addons/components/react-components.react.jsx @@ -419,7 +419,6 @@ function (app, FauxtonAPI, React, Components, ace, beautifyHelper) { }); - var ConfirmButton = React.createClass({ render: function () { return ( http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3c297051/app/addons/documents/header/header.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/header/header.react.jsx b/app/addons/documents/header/header.react.jsx index a5a1f5d..0b2b0df 100644 --- a/app/addons/documents/header/header.react.jsx +++ b/app/addons/documents/header/header.react.jsx @@ -218,12 +218,6 @@ function (app, FauxtonAPI, React, Stores, Actions, ReactComponents, IndexResults }); var Views = { - renderHeaderController: function (el) { - React.render(<HeaderBarController/>, el); - }, - removeHeaderController: function (el) { - React.unmountComponentAtNode(el); - }, BulkDocumentHeaderController: BulkDocumentHeaderController, HeaderBarController: HeaderBarController, ToggleHeaderButton: ToggleHeaderButton http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3c297051/app/addons/documents/pagination/pagination.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/documents/pagination/pagination.react.jsx b/app/addons/documents/pagination/pagination.react.jsx index b5729d5..1044eb0 100644 --- a/app/addons/documents/pagination/pagination.react.jsx +++ b/app/addons/documents/pagination/pagination.react.jsx @@ -187,12 +187,7 @@ define([ return { AllDocsNumber: AllDocsNumberController, PerPageSelector: PerPageSelector, - renderFooter: function (el) { - React.render(<Footer/>, el); - }, - removeFooter: function (el) { - React.unmountComponentAtNode(el); - } + Footer: Footer }; }); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3c297051/app/addons/documents/routes-documents.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-documents.js b/app/addons/documents/routes-documents.js index 695d991..7f8535c 100644 --- a/app/addons/documents/routes-documents.js +++ b/app/addons/documents/routes-documents.js @@ -27,11 +27,15 @@ define([ 'addons/fauxton/components', 'addons/documents/pagination/stores', 'addons/documents/index-results/actions', - 'addons/documents/index-results/index-results.components.react' + 'addons/documents/index-results/index-results.components.react', + 'addons/documents/pagination/pagination.react', + 'addons/documents/header/header.react', + 'addons/documents/header/header.actions' ], function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, DocEditor, Mango, - Databases, Resources, Components, PaginationStores, IndexResultsActions, IndexResultsComponents) { + Databases, Resources, Components, PaginationStores, IndexResultsActions, + IndexResultsComponents, ReactPagination, ReactHeader, ReactActions) { var DocumentsRouteObject = BaseRoute.extend({ @@ -81,9 +85,8 @@ function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, DocEdi }, designDocMetadata: function (database, ddoc) { - this.footer && this.footer.remove(); - this.toolsView && this.toolsView.remove(); - + this.removeComponent('#footer'); + this.removeComponent('#react-headerbar'); this.removeComponent('#dashboard-upper-content'); var designDocInfo = new Resources.DdocInfo({ _id: "_design/" + ddoc }, { database: this.database }); @@ -106,13 +109,14 @@ function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, DocEdi */ allDocs: function (databaseName, options) { var params = this.createParams(options), - urlParams = params.urlParams, - docParams = params.docParams, - collection; + urlParams = params.urlParams, + docParams = params.docParams, + collection; - this.reactHeader = this.setView('#react-headerbar', new Documents.Views.ReactHeaderbar()); + ReactActions.resetHeaderController(); - this.footer = this.setView('#footer', new Documents.Views.Footer()); + this.setComponent('#react-headerbar', ReactHeader.HeaderBarController); + this.setComponent('#footer', ReactPagination.Footer); this.leftheader.updateCrumbs(this.getCrumbs(this.database)); @@ -139,7 +143,6 @@ function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, DocEdi this.database.allDocs.paging.pageSize = PaginationStores.indexPaginationStore.getPerPage(); - //this.resultList = this.setView('#dashboard-lower-content', new Index.ViewResultListReact({})); this.setComponent('#dashboard-lower-content', IndexResultsComponents.List); // this used to be a function that returned the object, but be warned: it caused a closure with a reference to @@ -166,10 +169,10 @@ function (app, FauxtonAPI, BaseRoute, Documents, Changes, ChangesActions, DocEdi this.setComponent('#dashboard-upper-content', Changes.ChangesHeaderController); this.setComponent("#dashboard-lower-content", Changes.ChangesController); - this.footer && this.footer.remove(); - this.toolsView && this.toolsView.remove(); + this.removeComponent('#footer'); + this.removeComponent('#react-headerbar'); + this.viewEditor && this.viewEditor.remove(); - this.reactHeader && this.reactHeader.remove(); this.sidebar.setSelectedTab('changes'); this.leftheader.updateCrumbs(this.getCrumbs(this.database)); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3c297051/app/addons/documents/routes-index-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-index-editor.js b/app/addons/documents/routes-index-editor.js index b15177c..217cc7e 100644 --- a/app/addons/documents/routes-index-editor.js +++ b/app/addons/documents/routes-index-editor.js @@ -24,12 +24,14 @@ define([ 'addons/fauxton/components', 'addons/documents/pagination/stores', 'addons/documents/index-results/actions', - 'addons/documents/index-results/index-results.components.react' + 'addons/documents/index-results/index-results.components.react', + 'addons/documents/pagination/pagination.react' ], function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents, ActionsIndexEditor, - Databases, Components, PaginationStores, IndexResultsActions, IndexResultsComponents) { + Databases, Components, PaginationStores, IndexResultsActions, + IndexResultsComponents, ReactPagination) { var IndexEditorAndResults = BaseRoute.extend({ @@ -78,7 +80,7 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Documents, IndexEditorComponents, viewName = viewName.replace(/\?.*$/, ''); - this.footer = this.setView('#footer', new Documents.Views.Footer()); + this.setComponent('#footer', ReactPagination.Footer); this.indexedDocs = new Documents.IndexCollection(null, { database: this.database, http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3c297051/app/addons/documents/routes-mango.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-mango.js b/app/addons/documents/routes-mango.js index baade58..d8c3d64 100644 --- a/app/addons/documents/routes-mango.js +++ b/app/addons/documents/routes-mango.js @@ -23,14 +23,16 @@ define([ 'addons/documents/resources', 'addons/documents/views', - 'addons/documents/index-results/actions', 'addons/documents/pagination/stores', + 'addons/documents/header/header.react', + 'addons/documents/header/header.actions' ], function (app, FauxtonAPI, Helpers, BaseRoute, Mango, Databases, - Components, Resources, Documents, IndexResultsActions, PaginationStores) { + Components, Resources, Documents, IndexResultsActions, + PaginationStores, ReactHeader, ReactActions) { var MangoIndexList = BaseRoute.extend({ layout: 'with_tabs_sidebar', @@ -76,6 +78,8 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Mango, Databases, } }); + ReactActions.resetHeaderController(); + this.viewEditor && this.viewEditor.remove(); this.headerView && this.headerView.remove(); @@ -86,7 +90,7 @@ function (app, FauxtonAPI, Helpers, BaseRoute, Mango, Databases, isListDeletable: false }); - this.reactHeader = this.setView('#react-headerbar', new Documents.Views.ReactHeaderbar()); + this.setComponent('#react-headerbar', ReactHeader.HeaderBarController); this.leftheader.updateCrumbs(this.getCrumbs(this.database)); this.rightHeader.hideQueryOptions(); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/3c297051/app/addons/documents/views.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/views.js b/app/addons/documents/views.js index 9ea6ebc..b376b45 100644 --- a/app/addons/documents/views.js +++ b/app/addons/documents/views.js @@ -21,20 +21,12 @@ define([ "addons/documents/shared-views", "addons/documents/views-queryoptions", - // React - 'addons/documents/header/header.react', - 'addons/documents/header/header.actions', - 'addons/documents/pagination/pagination.react', - 'addons/documents/index-results/actions', - 'addons/documents/pagination/stores', - //plugins "plugins/prettify" ], function (app, FauxtonAPI, Components, Documents, - Databases, Views, QueryOptions, ReactHeader, ReactHeaderActions, - ReactPagination, IndexResultsActions, PaginationStores) { + Databases, Views, QueryOptions) { function showError (msg) { FauxtonAPI.addNotification({ @@ -44,31 +36,6 @@ function (app, FauxtonAPI, Components, Documents, }); } - Views.Footer = FauxtonAPI.View.extend({ - afterRender: function () { - ReactPagination.renderFooter(this.el); - }, - - cleanup: function () { - ReactPagination.removeFooter(this.el); - } - }); - - Views.ReactHeaderbar = FauxtonAPI.View.extend({ - afterRender: function () { - ReactHeader.renderHeaderController(this.el); - }, - - cleanup: function () { - this.disableHeader(); - ReactHeader.removeHeaderController(this.el); - }, - - disableHeader: function () { - ReactHeaderActions.resetHeaderController(); - } - }); - Views.RightAllDocsHeader = FauxtonAPI.View.extend({ className: "header-right", template: "addons/documents/templates/all_docs_header",
