Fauxton: remove route events from main.js
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/c86d73f0 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c86d73f0 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c86d73f0 Branch: refs/heads/1828-duplicate-doc Commit: c86d73f03a640b50efe46da79baeba482db12b08 Parents: 5f86eca Author: Garren Smith <[email protected]> Authored: Tue Jul 2 09:38:39 2013 +0200 Committer: Garren Smith <[email protected]> Committed: Tue Jul 2 09:38:39 2013 +0200 ---------------------------------------------------------------------- src/fauxton/app/main.js | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/c86d73f0/src/fauxton/app/main.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/main.js b/src/fauxton/app/main.js index 203b295..2f8f8fa 100644 --- a/src/fauxton/app/main.js +++ b/src/fauxton/app/main.js @@ -1,9 +1,9 @@ require([ - // Application. - "app", + // Application. + "app", - // Main Router. - "router" + // Main Router. + "router" ], function(app, Router) { @@ -23,25 +23,16 @@ function(app, Router) { // Get the absolute root. var root = location.protocol + "//" + location.host + app.root; - var routeEvent = $(this).attr("route-event"); - if (routeEvent) { + // Ensure the root is part of the anchor href, meaning it's relative. + if (href.prop && href.prop.slice(0, root.length) === root) { + // Stop the default event to ensure the link will not cause a page + // refresh. evt.preventDefault(); - // TODO:: change to false when route events are functional - Backbone.history.navigate(href.attr, true); - // Trigger route events after update of history so that we can get params from url - app.router.triggerRouteEvent("route:"+routeEvent, href); - } else { - // Ensure the root is part of the anchor href, meaning it's relative. - if (href.prop && href.prop.slice(0, root.length) === root) { - // Stop the default event to ensure the link will not cause a page - // refresh. - evt.preventDefault(); - // `Backbone.history.navigate` is sufficient for all Routers and will - // trigger the correct events. The Router's internal `navigate` method - // calls this anyways. The fragment is sliced from the root. - Backbone.history.navigate(href.attr, true); - } + // `Backbone.history.navigate` is sufficient for all Routers and will + // trigger the correct events. The Router's internal `navigate` method + // calls this anyways. The fragment is sliced from the root. + Backbone.history.navigate(href.attr, true); } }); });
