Commit 84a81054 authored by Jérome Perrin's avatar Jérome Perrin

Graph editor: Do not pass useless parameters

parent a17407ef
...@@ -438,15 +438,24 @@ ...@@ -438,15 +438,24 @@
return expanded_class_definition; return expanded_class_definition;
} }
// TODO: remove class_definition from this function and callees signature function openNodeDialog(gadget, element) {
function openNodeDialog(gadget, element, class_definition) {
var node_id = getNodeId(gadget, element.id), var node_id = getNodeId(gadget, element.id),
node_data = gadget.props.data.graph.node[node_id], node_data = gadget.props.data.graph.node[node_id],
node_edit_popup = $(gadget.props.element).find('#popup-edit-template'), node_edit_popup = $(gadget.props.element).find('#popup-edit-template'),
schema = expandSchema(class_definition, gadget.props.data), schema,
fieldset_element, fieldset_element,
delete_promise; delete_promise;
// If we have no definition for this, we do not allow edition.
if ( gadget.props.data.class_definition[node_data._class] === undefined ) {
return;
}
schema = expandSchema(
gadget.props.data.class_definition[node_data._class],
gadget.props.data
);
if (node_edit_popup.length !== 0) { if (node_edit_popup.length !== 0) {
node_edit_popup.remove(); node_edit_popup.remove();
} }
...@@ -528,13 +537,13 @@ ...@@ -528,13 +537,13 @@
}); });
} }
function waitForNodeClick(gadget, node, config_dict) { function waitForNodeClick(gadget, node) {
gadget.props.nodes_click_monitor gadget.props.nodes_click_monitor
.monitor(loopEventListener( .monitor(loopEventListener(
node, node,
'dblclick', 'dblclick',
false, false,
openNodeDialog.bind(null, gadget, node, config_dict) openNodeDialog.bind(null, gadget, node)
)); ));
} }
...@@ -576,7 +585,7 @@ ...@@ -576,7 +585,7 @@
).querySelector('.window'); ).querySelector('.window');
render_element.append(domElement); render_element.append(domElement);
waitForNodeClick(gadget, domElement, class_definition); waitForNodeClick(gadget, domElement);
box = $(gadget.props.element).find("#" + dom_element_id); box = $(gadget.props.element).find("#" + dom_element_id);
absolute_position = convertToAbsolutePosition( absolute_position = convertToAbsolutePosition(
......
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