Commit 1a96434f authored by Thibaut Frain's avatar Thibaut Frain Committed by Jérome Perrin

restore previous node edition popup behaviour

parent ab2056a5
...@@ -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">
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* ==========================================================================*/ * ==========================================================================*/
/*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, (function (RSVP, rJS, $, jsPlumb, Handlebars, initGadgetMixin,
loopEventListener, promiseEventListener, DOMParser) { loopEventListener, promiseEventListener, DOMParser) {
...@@ -307,6 +307,11 @@ ...@@ -307,6 +307,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;
} }
...@@ -519,7 +524,7 @@ ...@@ -519,7 +524,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"
}); });
...@@ -581,7 +586,7 @@ ...@@ -581,7 +586,7 @@
gadget.props.nodes_click_monitor gadget.props.nodes_click_monitor
.monitor(loopEventListener( .monitor(loopEventListener(
node, node,
'click', 'dblclick',
false, false,
openNodeDialog.bind(null, gadget, node, config_dict) openNodeDialog.bind(null, gadget, node, config_dict)
)); ));
...@@ -595,6 +600,7 @@ ...@@ -595,6 +600,7 @@
box, box,
absolute_position, absolute_position,
domElement; domElement;
element.element_id = generateElementId(gadget.props.element); element.element_id = generateElementId(gadget.props.element);
if (!element.id) { if (!element.id) {
element.id = generateNodeId(gadget, element_type, option); element.id = generateNodeId(gadget, element_type, option);
...@@ -698,7 +704,6 @@ ...@@ -698,7 +704,6 @@
.declareAcquiredMethod('getConfigurationDict', 'getConfigurationDict') .declareAcquiredMethod('getConfigurationDict', 'getConfigurationDict')
.ready(function (g) { .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 = [ g.props.style_attr_list = [
...@@ -711,6 +716,7 @@ ...@@ -711,6 +716,7 @@
.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();
}) })
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
.innerHTML, .innerHTML,
option_template = Handlebars.compile(option_source), option_template = Handlebars.compile(option_source),
selected_option_source = gadget_klass.__template_element selected_option_source = gadget_klass.__template_element
.getElementById("option-template") .getElementById("selected-option-template")
.innerHTML, .innerHTML,
selected_option_template = Handlebars.compile(selected_option_source); selected_option_template = Handlebars.compile(selected_option_source);
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
tmp = ''; 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.value) {
if (field_json.items[i][1] === field_json.default[0]) {
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