client/js/router.js
author rougeronj
Thu, 25 Jun 2015 18:09:49 +0200
changeset 510 a8f02d66bf02
parent 473 6649d2d75a87
permissions -rw-r--r--
adapt the viewRepr to support a temp View (a representation without a model) update the router to send a event also if the parameters are null

(function(root) {
    "use strict";
    
    var Backbone = root.Backbone;
    
    var Router = root.Rkns.Router = Backbone.Router.extend({
        routes: {
            '': 'index'
        },
        
        index: function (parameters) {
            
            var result = {};
            if (parameters !== null){
                parameters.split("&").forEach(function(part) {
                    var item = part.split("=");
                    result[item[0]] = decodeURIComponent(item[1]);
                });
            }
            this.trigger('router', result);        
        }  
    });

})(window);