--- a/client/js/router.js Fri Jun 05 12:17:16 2015 +0200
+++ b/client/js/router.js Wed Jun 10 15:58:42 2015 +0200
@@ -5,22 +5,20 @@
var Router = root.Rkns.Router = Backbone.Router.extend({
routes: {
- '': 'index',
- '*params': 'setParams'
+ '': 'index'
},
- index: function(){
- this.params = {};
- },
- setParams: function (parameters) {
- var _this = this;
- this.params = {};
+ index: function (parameters) {
- parameters.split('&').forEach(function(param){
- _this.params[param.split('=')[0]] = param.split('=')[1] || null;
- _this.trigger(param.split('=')[0], param.split('=')[1]);
+ var result = {};
+ if (parameters === null){
+ return;
+ }
+ parameters.split("&").forEach(function(part) {
+ var item = part.split("=");
+ result[item[0]] = decodeURIComponent(item[1]);
});
-
+ this.trigger('router', result);
}
});