diff options
author | Garren Smith <garren.smith@gmail.com> | 2013-07-02 09:38:39 +0200 |
---|---|---|
committer | Garren Smith <garren.smith@gmail.com> | 2013-07-02 09:38:39 +0200 |
commit | c86d73f03a640b50efe46da79baeba482db12b08 (patch) | |
tree | e96600fe54a06f8b20fd73a6cff213f25cf9126f | |
parent | 5f86eca6fe514c4ce31b68269c729e15f6820440 (diff) | |
download | couchdb-c86d73f03a640b50efe46da79baeba482db12b08.tar.gz |
Fauxton: remove route events from main.js
-rw-r--r-- | src/fauxton/app/main.js | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/fauxton/app/main.js b/src/fauxton/app/main.js index 203b2956b..2f8f8fa95 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); } }); }); |