Commit f9a6a539 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

minor clean-up

parent b57eca9d
/*global window, document, RSVP, rJS, initGadgetMixin, console*/ /*global window, document, RSVP, rJS, initGadgetMixin*/
(function (window, document, RSVP, rJS, initGadgetMixin) { (function (window, document, RSVP, rJS, initGadgetMixin) {
"use strict"; "use strict";
...@@ -38,26 +38,18 @@ ...@@ -38,26 +38,18 @@
tools_container = document.createElement('div'); tools_container = document.createElement('div');
/* display all nodes in the palette. /* display all nodes in the palette.
*/ */
console.log("RENDERING TOOLBOX");
tools_container.className = 'tools-container'; tools_container.className = 'tools-container';
Object.keys(data.class_definition).forEach(function (key) { Object.keys(data.class_definition).forEach(function (key) {
var _class_object = data.class_definition[key], tool; var _class_object = data.class_definition[key], tool;
// XXX "expand" the json schema "allOF" etc // XXX "expand" the json schema "allOF" etc
console.log(_class_object);
if (_class_object.allOf) { if (_class_object.allOf) {
console.log("yupi");
if (_class_object.allOf[0].$ref === "#/class_definition/node") { if (_class_object.allOf[0].$ref === "#/class_definition/node") {
console.log("yupi2");
tool = document.createElement('div'); tool = document.createElement('div');
// XXX maybe allow to configure the class name ? // XXX maybe allow to configure the class name ?
tool.className = "tool " + key; tool.className = "tool " + key;
console.log("..");
console.log(tool.className);
tool.textContent = _class_object.name || key; tool.textContent = _class_object.name || key;
console.log(tool.textContent);
tool.draggable = true; tool.draggable = true;
tool.dataset.class_name = JSON.stringify(key); tool.dataset.class_name = JSON.stringify(key);
console.log(tool.dataset.class_name);
Object.keys(_class_object.css || {}).forEach(function (k) { Object.keys(_class_object.css || {}).forEach(function (k) {
tool.style[k] = _class_object.css[k]; tool.style[k] = _class_object.css[k];
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment