1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Allow multiple config types in a node

Fixes #170
This commit is contained in:
Nick O'Leary 2014-02-28 20:58:04 +00:00
parent 1c655b5945
commit 68d5ebf388

View File

@ -18,6 +18,12 @@ RED.editor = function() {
// TODO: should IMPORT/EXPORT get their own dialogs? // TODO: should IMPORT/EXPORT get their own dialogs?
function onInputLookupClick(select,name,type) {
return function(e) {
showEditConfigNodeDialog(name,type,select.find(":selected").val());
e.preventDefault();
}
}
function showEditDialog(node) { function showEditDialog(node) {
editing_node = node; editing_node = node;
RED.view.state(RED.state.EDITING); RED.view.state(RED.state.EDITING);
@ -34,12 +40,7 @@ RED.editor = function() {
updateConfigNodeSelect(d,def.type,node[d]); updateConfigNodeSelect(d,def.type,node[d]);
var select = $("#node-input-"+d); var select = $("#node-input-"+d);
select.after(' <a id="node-input-lookup-'+d+'" class="btn"><i class="icon icon-pencil"></i></a>'); select.after(' <a id="node-input-lookup-'+d+'" class="btn"><i class="icon icon-pencil"></i></a>');
var name = d; $('#node-input-lookup-'+d).click(onInputLookupClick(select,d,def.type));
var type = def.type;
$('#node-input-lookup-'+d).click(function(e) {
showEditConfigNodeDialog(name,type,select.find(":selected").val());
e.preventDefault();
});
var label = ""; var label = "";
var configNode = RED.nodes.node(node[d]); var configNode = RED.nodes.node(node[d]);
if (configNode && node_def.label) { if (configNode && node_def.label) {