mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add drag handle to switch node rules
This commit is contained in:
parent
0ed8d28342
commit
da67e69544
@ -83,9 +83,10 @@
|
||||
];
|
||||
|
||||
function generateRule(i,rule) {
|
||||
var container = $('<li/>',{style:"cursor: move; background: #fff; margin:0; padding:8px 0px; border-bottom: 1px solid #ccc;"});
|
||||
var container = $('<li/>',{style:"background: #fff; margin:0; padding:8px 0px; border-bottom: 1px solid #ccc;"});
|
||||
var row = $('<div/>').appendTo(container);
|
||||
var row2 = $('<div/>',{style:"padding-top: 5px; text-align: right;"}).appendTo(container);
|
||||
$('<i style="color: #eee; cursor: move;" class="node-input-rule-handle fa fa-bars"></i>').appendTo(row);
|
||||
|
||||
var selectField = $('<select/>',{style:"width:120px; margin-left: 5px; text-align: center;"}).appendTo(row);
|
||||
for (var d in operators) {
|
||||
@ -99,7 +100,10 @@
|
||||
var btwnValue2Field = $('<input/>',{class:"node-input-rule-btwn-value2",type:"text",style:"width: 50px;margin-left:2px;"}).appendTo(btwnField);
|
||||
|
||||
var finalspan = $('<span/>',{style:"float: right; margin-top: 3px;margin-right: 10px;"}).appendTo(row);
|
||||
finalspan.append(' send to <span class="node-input-rule-index">'+i+'</span> ');
|
||||
finalspan.append(' → <span class="node-input-rule-index">'+i+'</span> ');
|
||||
|
||||
var deleteButton = $('<a/>',{href:"#",class:"btn btn-mini", style:"margin-left: 5px;"}).appendTo(finalspan);
|
||||
$('<i/>',{class:"fa fa-remove"}).appendTo(deleteButton);
|
||||
|
||||
selectField.change(function() {
|
||||
var type = selectField.children("option:selected").val();
|
||||
@ -123,8 +127,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
var deleteButton = $('<a/>',{href:"#",class:"btn btn-mini", style:"margin-left: 5px;"}).appendTo(finalspan);
|
||||
$('<i/>',{class:"fa fa-remove"}).appendTo(deleteButton);
|
||||
|
||||
deleteButton.click(function() {
|
||||
container.css({"background":"#fee"});
|
||||
@ -177,7 +179,9 @@
|
||||
rules.each(function(i) {
|
||||
$(this).find(".node-input-rule-index").html(i+1);
|
||||
});
|
||||
}
|
||||
},
|
||||
handle:".node-input-rule-handle",
|
||||
cursor: "move"
|
||||
});
|
||||
$( "#node-input-rule-container" ).disableSelection();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user