Repository: couchdb-fauxton Updated Branches: refs/heads/master 175546946 -> 9c69f1cb2
doc editor: fix ambiguous routing given you created a design doc called `_design/conflicts` it would match with the route for the conflict browser and not with the document editor. PR: #778 PR-URL: https://github.com/apache/couchdb-fauxton/pull/778 Reviewed-By: garren smith <garren.sm...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/9c69f1cb Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/9c69f1cb Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/9c69f1cb Branch: refs/heads/master Commit: 9c69f1cb2de794d40d2e3e1bb2cc7e62776bebae Parents: 7e7a601 Author: Robert Kowalski <robertkowal...@apache.org> Authored: Tue Sep 27 17:45:29 2016 +0200 Committer: Robert Kowalski <robertkowal...@apache.org> Committed: Wed Sep 28 12:55:46 2016 +0200 ---------------------------------------------------------------------- app/addons/documents/routes-doc-editor.js | 57 ++++++++------------------ app/addons/documents/routes.js | 1 - 2 files changed, 16 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/9c69f1cb/app/addons/documents/routes-doc-editor.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes-doc-editor.js b/app/addons/documents/routes-doc-editor.js index 718fd9a..196c642 100644 --- a/app/addons/documents/routes-doc-editor.js +++ b/app/addons/documents/routes-doc-editor.js @@ -21,45 +21,6 @@ import RevBrowserActions from "./rev-browser/rev-browser.actions"; import RevBrowserComponents from "./rev-browser/rev-browser.components.react"; -const RevBrowserRouteObject = FauxtonAPI.RouteObject.extend({ - layout: 'doc_editor', - selectedHeader: 'Databases', - roles: ['fx_loggedIn'], - - routes: { - 'database/:database/:doc/conflicts': 'revisionBrowser' - }, - - initialize: function (route, masterLayout, options) { - const databaseName = options[0]; - - this.docId = options[1]; - this.database = this.database || new Databases.Model({ id: databaseName }); - this.doc = new Documents.Doc({ _id: this.docId }, { database: this.database }); - }, - - crumbs: function () { - const backLink = FauxtonAPI.urls('allDocs', 'app', this.database.safeID()); - const docUrl = FauxtonAPI.urls('document', 'app', this.database.safeID(), this.docId); - - return [ - { name: this.database.safeID(), link: backLink }, - { name: this.docId + ' > Conflicts' } - ]; - }, - - apiUrl: function () { - return [this.doc.url('apiurl'), this.doc.documentation()]; - }, - - revisionBrowser: function (databaseName, docId) { - RevBrowserActions.showConfirmModal(false, null); - RevBrowserActions.initDiffEditor(databaseName, docId); - this.setComponent('#dashboard-content', RevBrowserComponents.DiffyController); - } - -}); - const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({ layout: 'doc_editor', selectedHeader: 'Databases', @@ -74,6 +35,7 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({ }, routes: { + 'database/:database/:doc/conflicts': 'revisionBrowser', 'database/:database/:doc/code_editor': 'codeEditor', 'database/:database/_design/:ddoc': 'showDesignDoc', 'database/:database/:doc': 'codeEditor', @@ -82,6 +44,20 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({ crumbs: function () {}, + revisionBrowser: function (databaseName, docId) { + const backLink = FauxtonAPI.urls('allDocs', 'app', this.database.safeID()); + const docUrl = FauxtonAPI.urls('document', 'app', this.database.safeID(), this.docId); + + this.crumbs = [ + { name: this.database.safeID(), link: backLink }, + { name: this.docId + ' > Conflicts' } + ]; + + RevBrowserActions.showConfirmModal(false, null); + RevBrowserActions.initDiffEditor(databaseName, docId); + this.setComponent('#dashboard-content', RevBrowserComponents.DiffyController); + }, + codeEditor: function (databaseName, docId) { const backLink = FauxtonAPI.urls('allDocs', 'app', databaseName); @@ -114,6 +90,5 @@ const DocEditorRouteObject = FauxtonAPI.RouteObject.extend({ export default { - DocEditorRouteObject: DocEditorRouteObject, - RevBrowserRouteObject: RevBrowserRouteObject + DocEditorRouteObject: DocEditorRouteObject }; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/9c69f1cb/app/addons/documents/routes.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js index c08a347..201659a 100644 --- a/app/addons/documents/routes.js +++ b/app/addons/documents/routes.js @@ -18,7 +18,6 @@ import Mango from "./routes-mango"; Documents.RouteObjects = [ docEditor.DocEditorRouteObject, - docEditor.RevBrowserRouteObject, DocumentsRouteObject, IndexEditorRouteObject, Mango.MangoIndexEditorAndQueryEditor