You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/07/08 18:00:01 UTC
[08/21] git commit: updated refs/heads/1846-dev-server-improvements
to 5da4bbf
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/1846-dev-server-improvements
Commit: c86d73f03a640b50efe46da79baeba482db12b08
Parents: 5f86eca
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Jul 2 09:38:39 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
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);
}
});
});