equal
deleted
inserted
replaced
318 },50); |
318 },50); |
319 |
319 |
320 this.addRepresentations("Node", this.renkan.project.get("nodes")); |
320 this.addRepresentations("Node", this.renkan.project.get("nodes")); |
321 this.addRepresentations("Edge", this.renkan.project.get("edges")); |
321 this.addRepresentations("Edge", this.renkan.project.get("edges")); |
322 this.renkan.project.on("change:title", function() { |
322 this.renkan.project.on("change:title", function() { |
323 _this.$.find(".Rk-PadTitle").val(_renkan.project.get("title")); |
323 _this.$.find(".Rk-PadTitle").val(_renkan.project.get("title")).prop('title', _renkan.project.get("title")); |
324 }); |
324 }); |
325 |
325 |
326 this.$.find(".Rk-PadTitle").on("keyup input paste", function() { |
326 this.$.find(".Rk-PadTitle").on("keyup input paste", function() { |
327 _renkan.project.set({"title": $(this).val()}); |
327 _renkan.project.set({"title": $(this).val()}); |
328 }); |
328 }); |
364 _thRedraw(); |
364 _thRedraw(); |
365 }); |
365 }); |
366 |
366 |
367 //register router events |
367 //register router events |
368 this.renkan.router.on("router", function(_params){ |
368 this.renkan.router.on("router", function(_params){ |
369 _this.setViewparameters(_params); |
369 _this.setViewParameters(_params); |
370 }); |
370 }); |
371 |
371 |
372 this.renkan.project.on("change:loadingStatus", function(){ |
372 this.renkan.project.on("change:loadingStatus", function(){ |
373 if (_this.renkan.project.get("loadingStatus")){ |
373 if (_this.renkan.project.get("loadingStatus")){ |
374 var animate = _this.$.find(".loader").addClass("run"); |
374 var animate = _this.$.find(".loader").addClass("run"); |
472 lastval = val; |
472 lastval = val; |
473 if (val.length < 2) { |
473 if (val.length < 2) { |
474 _renkan.project.get("nodes").each(function(n) { |
474 _renkan.project.get("nodes").each(function(n) { |
475 _this.getRepresentationByModel(n).unhighlight(); |
475 _this.getRepresentationByModel(n).unhighlight(); |
476 }); |
476 }); |
|
477 _renkan.project.get("edges").each(function(e) { |
|
478 _this.getRepresentationByModel(e).unhighlight(); |
|
479 }); |
477 } else { |
480 } else { |
478 var rxs = Utils.regexpFromTextOrArray(val); |
481 var rxs = Utils.regexpFromTextOrArray(val); |
479 _renkan.project.get("nodes").each(function(n) { |
482 _renkan.project.get("nodes").each(function(n) { |
480 if (rxs.test(n.get("title")) || rxs.test(n.get("description"))) { |
483 if (n.id === val || rxs.test(n.get("title")) || rxs.test(n.get("description"))) { |
481 _this.getRepresentationByModel(n).highlight(rxs); |
484 _this.getRepresentationByModel(n).highlight(rxs); |
482 } else { |
485 } else { |
483 _this.getRepresentationByModel(n).unhighlight(); |
486 _this.getRepresentationByModel(n).unhighlight(); |
484 } |
487 } |
485 }); |
488 }); |
|
489 _renkan.project.get("edges").each(function(e) { |
|
490 if (e.id === val || rxs.test(e.get("title")) || rxs.test(e.get("description"))) { |
|
491 _this.getRepresentationByModel(e).highlight(rxs); |
|
492 } else { |
|
493 _this.getRepresentationByModel(e).unhighlight(); |
|
494 } |
|
495 }); |
|
496 |
486 } |
497 } |
487 }); |
498 }); |
488 } |
499 } |
489 |
500 |
490 this.redraw(); |
501 this.redraw(); |
1224 var projectJSONStr = JSON.stringify(projectJSON, null, 2); |
1235 var projectJSONStr = JSON.stringify(projectJSON, null, 2); |
1225 var blob = new Blob([projectJSONStr], {type: "application/json;charset=utf-8"}); |
1236 var blob = new Blob([projectJSONStr], {type: "application/json;charset=utf-8"}); |
1226 filesaver(blob,fileNameToSaveAs); |
1237 filesaver(blob,fileNameToSaveAs); |
1227 |
1238 |
1228 }, |
1239 }, |
1229 setViewparameters: function(_params){ |
1240 setViewParameters: function(_params){ |
1230 this.removeRepresentationsOfType("View"); |
1241 this.removeRepresentationsOfType("View"); |
1231 if ($.isEmptyObject(_params)){ |
1242 if ($.isEmptyObject(_params)){ |
1232 this.view = this.addRepresentation("View", this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))); |
1243 this.view = this.addRepresentation("View", this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))); |
1233 return; |
1244 return; |
1234 } |
1245 } |
1262 this.view.showNodes(false); |
1273 this.view.showNodes(false); |
1263 } |
1274 } |
1264 } |
1275 } |
1265 //other parameters must go after because most of them depends on a view that must be initialize before |
1276 //other parameters must go after because most of them depends on a view that must be initialize before |
1266 this.unhighlightAll(); |
1277 this.unhighlightAll(); |
1267 if (typeof _params.idNode !== 'undefined'){ |
1278 if (typeof _params.node !== 'undefined' && _params.node){ |
1268 this.highlightModel(this.renkan.project.get("nodes").get(_params.idNode)); |
1279 this.highlightModel(this.renkan.project.get("nodes").get(_params.node)); |
1269 } |
1280 } |
|
1281 if (typeof _params.edge !== 'undefined' && _params.edge){ |
|
1282 this.highlightModel(this.renkan.project.get("edges").get(_params.edge)); |
|
1283 } |
|
1284 |
1270 }, |
1285 }, |
1271 validViewIndex: function(index){ |
1286 validViewIndex: function(index){ |
1272 //check if the view index exist (negative index is from the end) and return the correct index or false if doesn't exist |
1287 //check if the view index exist (negative index is from the end) and return the correct index or false if doesn't exist |
1273 var _index = parseInt(index); |
1288 var _index = parseInt(index); |
1274 var validIndex = 0; |
1289 var validIndex = 0; |