update router
add function "parameters" to scene to apply the correct changes depending on the parameters sent by the router
--- a/client/js/renderer/scene.js Fri Jun 05 12:17:16 2015 +0200
+++ b/client/js/renderer/scene.js Wed Jun 10 15:58:42 2015 +0200
@@ -402,10 +402,8 @@
});
//register router events
- this.renkan.router.on("idnode", function(_id){
- _this.unhighlightAll();
- _this.highlightModel(_this.renkan.project.get("nodes").get(_id));
-
+ this.renkan.router.on("router", function(_params){
+ _this.parameters(_params);
});
if (_renkan.options.size_bug_fix) {
@@ -975,7 +973,7 @@
y: _coords.y
}
};
- _node = this.renkan.project.addNode(_data);
+ var _node = this.renkan.project.addNode(_data);
this.getRepresentationByModel(_node).openEditor();
}
}
@@ -1318,6 +1316,12 @@
filesaver(blob,fileNameToSaveAs);
},
+ parameters: function(_params){
+ if (typeof _params.idnode !== 'undefined'){
+ this.unhighlightAll();
+ this.highlightModel(this.renkan.project.get("nodes").get(_params.idnode));
+ }
+ },
foldBins: function() {
var foldBinsButton = this.$.find(".Rk-Fold-Bins"),
bins = this.renkan.$.find(".Rk-Bins");
--- 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);
}
});