mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Add drag handle to switch node rules
This commit is contained in:
		| @@ -83,9 +83,10 @@ | |||||||
|             ]; |             ]; | ||||||
|  |  | ||||||
|             function generateRule(i,rule) { |             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 row = $('<div/>').appendTo(container); | ||||||
|                 var row2 = $('<div/>',{style:"padding-top: 5px; text-align: right;"}).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); |                 var selectField = $('<select/>',{style:"width:120px; margin-left: 5px; text-align: center;"}).appendTo(row); | ||||||
|                 for (var d in operators) { |                 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 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); |                 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() { |                 selectField.change(function() { | ||||||
|                     var type = selectField.children("option:selected").val(); |                     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() { |                 deleteButton.click(function() { | ||||||
|                     container.css({"background":"#fee"}); |                     container.css({"background":"#fee"}); | ||||||
| @@ -177,7 +179,9 @@ | |||||||
|                     rules.each(function(i) { |                     rules.each(function(i) { | ||||||
|                         $(this).find(".node-input-rule-index").html(i+1); |                         $(this).find(".node-input-rule-index").html(i+1); | ||||||
|                     }); |                     }); | ||||||
|                 } |                 }, | ||||||
|  |                 handle:".node-input-rule-handle", | ||||||
|  |                 cursor: "move" | ||||||
|             }); |             }); | ||||||
|             $( "#node-input-rule-container" ).disableSelection(); |             $( "#node-input-rule-container" ).disableSelection(); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user