Commit 33f3ad66 authored by Thomas Lechauve's avatar Thomas Lechauve

Added redirect method and set the default page

parent 4b8c8371
......@@ -91,6 +91,11 @@ $.extend({
}
},
redirect: function (hash) {
var hashInfo = this.parseHash(hash);
this.routes.search(hashInfo);
},
extractKeys: function (regex) {
var re_key = new RegExp(/:(\w+)/),
keys = [],
......
......@@ -96,6 +96,9 @@
$.router.routes.add('/catalog', nextLevel, methods.showCatalog, $("#main"));
$.router.routes.add('/dashboard', nextLevel, methods.showDashboard, $("#main"));
// default page
if (params.route === '/') {
$.router.redirect('/dashboard');
}
$.router.start(params.route, nextLevel);
},
......
......@@ -91,6 +91,11 @@ $.extend({
}
},
redirect: function (hash) {
var hashInfo = this.parseHash(hash);
this.routes.search(hashInfo);
},
extractKeys: function (regex) {
var re_key = new RegExp(/:(\w+)/),
keys = [],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment