--- a/client/js/dataloader.js Wed Jun 10 14:27:12 2015 +0200
+++ b/client/js/dataloader.js Wed Jun 10 16:00:45 2015 +0200
@@ -64,10 +64,10 @@
};
DataLoader.Loader.prototype.load = function(data) {
- console.log(data);
this.project.set(this.convert(data), {
validate: true
});
+ Backbone.history.start();
};
})(window);
--- a/client/js/main.js Wed Jun 10 14:27:12 2015 +0200
+++ b/client/js/main.js Wed Jun 10 16:00:45 2015 +0200
@@ -96,7 +96,7 @@
var _this = this;
Rkns.__renkans.push(this);
-
+
this.options = _.defaults(_opts, Rkns.defaults, {
templates: renkanJST
});
@@ -109,7 +109,9 @@
});
this.read_only = this.options.read_only || !this.options.editor_mode;
-
+
+ this.router = new Rkns.Router();
+
this.project = new Rkns.Models.Project();
this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);
@@ -297,7 +299,6 @@
this.$.find(".Rk-Bins-Search-Form").submit(function() {
return false;
});
-
};
Renkan.prototype.translate = function(_text) {
--- a/client/js/renderer/scene.js Wed Jun 10 14:27:12 2015 +0200
+++ b/client/js/renderer/scene.js Wed Jun 10 16:00:45 2015 +0200
@@ -400,6 +400,11 @@
el.text(_title);
}
});
+
+ //register router events
+ this.renkan.router.on("router", function(_params){
+ _this.parameters(_params);
+ });
if (_renkan.options.size_bug_fix) {
var _delay = (
@@ -968,7 +973,7 @@
y: _coords.y
}
};
- _node = this.renkan.project.addNode(_data);
+ var _node = this.renkan.project.addNode(_data);
this.getRepresentationByModel(_node).openEditor();
}
}
@@ -1311,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");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/js/router.js Wed Jun 10 16:00:45 2015 +0200
@@ -0,0 +1,25 @@
+(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){
+ return;
+ }
+ parameters.split("&").forEach(function(part) {
+ var item = part.split("=");
+ result[item[0]] = decodeURIComponent(item[1]);
+ });
+ this.trigger('router', result);
+ }
+ });
+
+})(window);
\ No newline at end of file
--- a/client/templates/nodeeditor_readonly.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/templates/nodeeditor_readonly.html Wed Jun 10 16:00:45 2015 +0200
@@ -26,3 +26,4 @@
<%- shortenText(node.created_by_title, 25) %>
</p>
<% } %>
+ <a href="/#?idnode=<%-node.id%>" target="_blank"><%-renkan.translate("Link to the node")%></a>
--- a/client/test/publish-test-min.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/publish-test-min.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/publish-test.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/publish-test.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
<script src="../dist/js/templates.js"></script>
--- a/client/test/render-test.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/render-test.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
<script src="../dist/js/templates.js"></script>
--- a/client/test/space-editor.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/space-editor.html Wed Jun 10 16:00:45 2015 +0200
@@ -15,6 +15,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
<script src="../dist/js/templates.js"></script>
--- a/client/test/test-readonly-body-no-zoom.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-readonly-body-no-zoom.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-readonly-body-zoom-save.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-readonly-body-zoom-save.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-readonly-body.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-readonly-body.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-readonly-div-editor-panel.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-readonly-div-editor-panel.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
<script src="../dist/js/templates.js"></script>
--- a/client/test/test-readonly-div-resize.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-readonly-div-resize.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-readonly-div.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-readonly-div.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
<script src="../dist/js/templates.js"></script>
--- a/client/test/test-writable-bins-div-100.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-bins-div-100.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
<script src="../dist/js/templates.js"></script>
--- a/client/test/test-writable-bins-div.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-bins-div.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-bins-save-on-click.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-bins-save-on-click.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-bins.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-bins.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-simple-div-editor-panel.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-simple-div-editor-panel.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-simple-div-user.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-simple-div-user.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-simple-div.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-simple-div.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-simple-empty.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-simple-empty.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-simple-no-img-upload.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-simple-no-img-upload.html Wed Jun 10 16:00:45 2015 +0200
@@ -15,6 +15,7 @@
<script src="../js/main.js"></script>
<script src="../js/models.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
<script src="../dist/js/templates.js"></script>
--- a/client/test/test-writable-simple-zoom-save.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-simple-zoom-save.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>
--- a/client/test/test-writable-simple.html Wed Jun 10 14:27:12 2015 +0200
+++ b/client/test/test-writable-simple.html Wed Jun 10 16:00:45 2015 +0200
@@ -14,6 +14,7 @@
<script src="../lib/paper/paper-full.js"></script>
<script src="../js/main.js"></script>
<script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
<script src="../js/models.js"></script>
<script src="../js/defaults.js"></script>
<script src="../js/i18n.js"></script>