Commit 5bf9c7d0 authored by Thibaut Frain's avatar Thibaut Frain Committed by Jérome Perrin

publish static version

parent 1a96434f
...@@ -22,8 +22,13 @@ ...@@ -22,8 +22,13 @@
</script> </script>
<template id="popup-edit-template"> <template id="popup-edit-template">
<div id="node-edit-popup"> <div id="node-edit-popup" data-position-to="origin">
<form> <div data-role="header" data-theme="a">
<h1>Node edition</h1>
<a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
</div>
<br/>
<form class="ui-content">
<fieldset></fieldset> <fieldset></fieldset>
<input type="button" value="Delete"> <input type="button" value="Delete">
<input type="submit" value="Validate"> <input type="submit" value="Validate">
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* along with DREAM. If not, see <http://www.gnu.org/licenses/>. * along with DREAM. If not, see <http://www.gnu.org/licenses/>.
* ==========================================================================*/ * ==========================================================================*/
/*global RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin, /*global RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin,
loopEventListener, promiseEventListener, DOMParser, confirm*/ loopEventListener, promiseEventListener, DOMParser, confirm */
/*jslint unparam: true */ /*jslint unparam: true */
(function(RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin, loopEventListener, promiseEventListener, DOMParser) { (function(RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin, loopEventListener, promiseEventListener, DOMParser) {
"use strict"; "use strict";
...@@ -214,6 +214,11 @@ ...@@ -214,6 +214,11 @@
name: element.name, name: element.name,
element_id: element.element_id element_id: element.element_id
}; };
Object.keys(element).forEach(function(k) {
if (k !== "_class" && k !== "name" && k !== "element_id") {
element_data[k] = element[k];
}
});
node_container[element.id] = element_data; node_container[element.id] = element_data;
} }
// function redraw(gadget) { // function redraw(gadget) {
...@@ -390,7 +395,7 @@ ...@@ -390,7 +395,7 @@
property_list.unshift({ property_list.unshift({
_class: "Dream.Property", _class: "Dream.Property",
id: "name", id: "name",
name: "name", name: "Name",
type: "string" type: "string"
}); });
property_list.unshift({ property_list.unshift({
...@@ -425,7 +430,7 @@ ...@@ -425,7 +430,7 @@
}); });
} }
function waitForNodeClick(gadget, node, config_dict) { function waitForNodeClick(gadget, node, config_dict) {
gadget.props.nodes_click_monitor.monitor(loopEventListener(node, "click", false, openNodeDialog.bind(null, gadget, node, config_dict))); gadget.props.nodes_click_monitor.monitor(loopEventListener(node, "dblclick", false, openNodeDialog.bind(null, gadget, node, config_dict)));
} }
function newElement(gadget, element, configuration) { function newElement(gadget, element, configuration) {
var element_type = element._class.replace(".", "-"), option = configuration[element_type], render_element = $(gadget.props.element).find("#main"), coordinate = element.coordinate, box, absolute_position, domElement; var element_type = element._class.replace(".", "-"), option = configuration[element_type], render_element = $(gadget.props.element).find("#main"), coordinate = element.coordinate, box, absolute_position, domElement;
...@@ -492,12 +497,12 @@ ...@@ -492,12 +497,12 @@
} }
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
gadget_klass.declareAcquiredMethod("getConfigurationDict", "getConfigurationDict").ready(function(g) { gadget_klass.declareAcquiredMethod("getConfigurationDict", "getConfigurationDict").ready(function(g) {
g.props.node_container = {};
g.props.edge_container = {}; g.props.edge_container = {};
g.props.preference_container = {}; g.props.preference_container = {};
g.props.style_attr_list = [ "width", "height", "padding-top", "line-height" ]; g.props.style_attr_list = [ "width", "height", "padding-top", "line-height" ];
}).declareMethod("render", function(data) { }).declareMethod("render", function(data) {
this.props.data = JSON.parse(data); this.props.data = JSON.parse(data);
this.props.node_container = this.props.data.nodes;
this.props.jsplumb_instance = jsPlumb.getInstance(); this.props.jsplumb_instance = jsPlumb.getInstance();
}).declareMethod("getData", function() { }).declareMethod("getData", function() {
return JSON.stringify({ return JSON.stringify({
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// Handlebars // Handlebars
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance // Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window), option_source = gadget_klass.__template_element.getElementById("option-template").innerHTML, option_template = Handlebars.compile(option_source), selected_option_source = gadget_klass.__template_element.getElementById("option-template").innerHTML, selected_option_template = Handlebars.compile(selected_option_source); var gadget_klass = rJS(window), option_source = gadget_klass.__template_element.getElementById("option-template").innerHTML, option_template = Handlebars.compile(option_source), selected_option_source = gadget_klass.__template_element.getElementById("selected-option-template").innerHTML, selected_option_template = Handlebars.compile(selected_option_source);
gadget_klass.ready(function(g) { gadget_klass.ready(function(g) {
return g.getElement().push(function(element) { return g.getElement().push(function(element) {
g.element = element; g.element = element;
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
var select = this.element.getElementsByTagName("select")[0], i, template, field_json = options.field_json, tmp = ""; var select = this.element.getElementsByTagName("select")[0], i, template, field_json = options.field_json, tmp = "";
select.setAttribute("name", field_json.key); select.setAttribute("name", field_json.key);
for (i = 0; i < field_json.items.length; i += 1) { for (i = 0; i < field_json.items.length; i += 1) {
if (field_json.items[i][1] === field_json.default[0]) { if (field_json.items[i][1] === field_json.value) {
template = selected_option_template; template = selected_option_template;
} else { } else {
template = option_template; template = option_template;
......
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