mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Namespace dropdown menu CSS
This commit is contained in:
@@ -481,8 +481,8 @@ var RED = (function() {
|
||||
menuOptions.push({id:"menu-item-node-red-version", label:"v"+RED.settings.version, onselect: "core:show-about" });
|
||||
|
||||
|
||||
$('<li><a id="btn-sidemenu" class="button" href="#"><i class="fa fa-bars"></i></a></li>').appendTo(".red-ui-header-toolbar")
|
||||
RED.menu.init({id:"btn-sidemenu",options: menuOptions});
|
||||
$('<li><a id="red-ui-header-button-sidemenu" class="button" href="#"><i class="fa fa-bars"></i></a></li>').appendTo(".red-ui-header-toolbar")
|
||||
RED.menu.init({id:"red-ui-header-button-sidemenu",options: menuOptions});
|
||||
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ RED.menu = (function() {
|
||||
item = $('<li></li>');
|
||||
|
||||
if (opt.group) {
|
||||
item.addClass("menu-group-"+opt.group);
|
||||
item.addClass("rd-ui-menu-group-"+opt.group);
|
||||
|
||||
}
|
||||
var linkContent = '<a '+(opt.id?'id="'+opt.id+'" ':'')+'tabindex="-1" href="#">';
|
||||
@@ -79,10 +79,10 @@ RED.menu = (function() {
|
||||
}
|
||||
|
||||
if (opt.sublabel) {
|
||||
linkContent += '<span class="menu-label-container"><span class="menu-label">'+opt.label+'</span>'+
|
||||
'<span class="menu-sublabel">'+opt.sublabel+'</span></span>'
|
||||
linkContent += '<span class="red-ui-menu-label-container"><span class="red-ui-menu-label">'+opt.label+'</span>'+
|
||||
'<span class="red-ui-menu-sublabel">'+opt.sublabel+'</span></span>'
|
||||
} else {
|
||||
linkContent += '<span class="menu-label">'+opt.label+'</span>'
|
||||
linkContent += '<span class="red-ui-menu-label">'+opt.label+'</span>'
|
||||
}
|
||||
|
||||
linkContent += '</a>';
|
||||
@@ -130,8 +130,8 @@ RED.menu = (function() {
|
||||
});
|
||||
}
|
||||
if (opt.options) {
|
||||
item.addClass("dropdown-submenu pull-left");
|
||||
var submenu = $('<ul id="'+opt.id+'-submenu" class="dropdown-menu"></ul>').appendTo(item);
|
||||
item.addClass("red-ui-menu-dropdown-submenu pull-left");
|
||||
var submenu = $('<ul id="'+opt.id+'-submenu" class="red-ui-menu-dropdown"></ul>').appendTo(item);
|
||||
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
var li = createMenuItem(opt.options[i]);
|
||||
@@ -150,7 +150,7 @@ RED.menu = (function() {
|
||||
|
||||
}
|
||||
function createMenu(options) {
|
||||
var topMenu = $("<ul/>",{class:"red-ui-menu dropdown-menu pull-right"});
|
||||
var topMenu = $("<ul/>",{class:"red-ui-menu red-ui-menu-dropdown pull-right"});
|
||||
|
||||
if (options.id) {
|
||||
topMenu.attr({id:options.id+"-submenu"});
|
||||
@@ -239,13 +239,13 @@ RED.menu = (function() {
|
||||
function addItem(id,opt) {
|
||||
var item = createMenuItem(opt);
|
||||
if (opt.group) {
|
||||
var groupItems = $("#"+id+"-submenu").children(".menu-group-"+opt.group);
|
||||
var groupItems = $("#"+id+"-submenu").children(".red-ui-menu-group-"+opt.group);
|
||||
if (groupItems.length === 0) {
|
||||
item.appendTo("#"+id+"-submenu");
|
||||
} else {
|
||||
for (var i=0;i<groupItems.length;i++) {
|
||||
var groupItem = groupItems[i];
|
||||
var label = $(groupItem).find(".menu-label").html();
|
||||
var label = $(groupItem).find(".red-ui-menu-label").html();
|
||||
if (opt.label < label) {
|
||||
$(groupItem).before(item);
|
||||
break;
|
||||
|
@@ -36,7 +36,7 @@ RED.deploy = (function() {
|
||||
|
||||
function changeDeploymentType(type) {
|
||||
deploymentType = type;
|
||||
$("#btn-deploy-icon").attr("src",deploymentTypes[type].img);
|
||||
$("#red-ui-header-button-deploy-icon").attr("src",deploymentTypes[type].img);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,19 +51,19 @@ RED.deploy = (function() {
|
||||
var type = options.type || "default";
|
||||
|
||||
if (type == "default") {
|
||||
$('<li><span class="deploy-button-group button-group">'+
|
||||
'<a id="btn-deploy" class="deploy-button disabled" href="#">'+
|
||||
'<span class="deploy-button-content">'+
|
||||
'<img id="btn-deploy-icon" src="red/images/deploy-full-o.png"> '+
|
||||
$('<li><span class="red-ui-deploy-button-group button-group">'+
|
||||
'<a id="red-ui-header-button-deploy" class="red-ui-deploy-button disabled" href="#">'+
|
||||
'<span class="red-ui-deploy-button-content">'+
|
||||
'<img id="red-ui-header-button-deploy-icon" src="red/images/deploy-full-o.png"> '+
|
||||
'<span>'+RED._("deploy.deploy")+'</span>'+
|
||||
'</span>'+
|
||||
'<span class="deploy-button-spinner hide">'+
|
||||
'<span class="red-ui-deploy-button-spinner hide">'+
|
||||
'<img src="red/images/spin.svg"/>'+
|
||||
'</span>'+
|
||||
'</a>'+
|
||||
'<a id="btn-deploy-options" class="deploy-button" href="#"><i class="fa fa-caret-down"></i></a>'+
|
||||
'<a id="red-ui-header-button-deploy-options" class="red-ui-deploy-button" href="#"><i class="fa fa-caret-down"></i></a>'+
|
||||
'</span></li>').prependTo(".red-ui-header-toolbar");
|
||||
RED.menu.init({id:"btn-deploy-options",
|
||||
RED.menu.init({id:"red-ui-header-button-deploy-options",
|
||||
options: [
|
||||
{id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.png",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}},
|
||||
{id:"deploymenu-item-flow",toggle:"deploy-type",icon:"red/images/deploy-flows.png",label:RED._("deploy.modifiedFlows"),sublabel:RED._("deploy.modifiedFlowsDesc"), onselect:function(s) {if(s){changeDeploymentType("flows")}}},
|
||||
@@ -80,20 +80,20 @@ RED.deploy = (function() {
|
||||
icon = options.icon;
|
||||
}
|
||||
|
||||
$('<li><span class="deploy-button-group button-group">'+
|
||||
'<a id="btn-deploy" class="deploy-button disabled" href="#">'+
|
||||
'<span class="deploy-button-content">'+
|
||||
(icon?'<img id="btn-deploy-icon" src="'+icon+'"> ':'')+
|
||||
$('<li><span class="red-ui-deploy-button-group button-group">'+
|
||||
'<a id="red-ui-header-button-deploy" class="red-ui-deploy-button disabled" href="#">'+
|
||||
'<span class="red-ui-deploy-button-content">'+
|
||||
(icon?'<img id="red-ui-header-button-deploy-icon" src="'+icon+'"> ':'')+
|
||||
'<span>'+label+'</span>'+
|
||||
'</span>'+
|
||||
'<span class="deploy-button-spinner hide">'+
|
||||
'<span class="red-ui-deploy-button-spinner hide">'+
|
||||
'<img src="red/images/spin.svg"/>'+
|
||||
'</span>'+
|
||||
'</a>'+
|
||||
'</span></li>').prependTo(".red-ui-header-toolbar");
|
||||
}
|
||||
|
||||
$('#btn-deploy').on("click", function(event) {
|
||||
$('#red-ui-header-button-deploy').on("click", function(event) {
|
||||
event.preventDefault();
|
||||
save();
|
||||
});
|
||||
@@ -107,10 +107,10 @@ RED.deploy = (function() {
|
||||
window.onbeforeunload = function() {
|
||||
return RED._("deploy.confirm.undeployedChanges");
|
||||
}
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
} else {
|
||||
window.onbeforeunload = null;
|
||||
$("#btn-deploy").addClass("disabled");
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -266,10 +266,10 @@ RED.deploy = (function() {
|
||||
}
|
||||
function restart() {
|
||||
var startTime = Date.now();
|
||||
$(".deploy-button-content").css('opacity',0);
|
||||
$(".deploy-button-spinner").show();
|
||||
var deployWasEnabled = !$("#btn-deploy").hasClass("disabled");
|
||||
$("#btn-deploy").addClass("disabled");
|
||||
$(".red-ui-deploy-button-content").css('opacity',0);
|
||||
$(".red-ui-deploy-button-spinner").show();
|
||||
var deployWasEnabled = !$("#red-ui-header-button-deploy").hasClass("disabled");
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
deployInflight = true;
|
||||
$("#red-ui-header-shade").show();
|
||||
$("#red-ui-editor-shade").show();
|
||||
@@ -284,12 +284,12 @@ RED.deploy = (function() {
|
||||
}
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
if (deployWasEnabled) {
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
}
|
||||
RED.notify('<p>'+RED._("deploy.successfulRestart")+'</p>',"success");
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
if (deployWasEnabled) {
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
}
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||
@@ -304,8 +304,8 @@ RED.deploy = (function() {
|
||||
deployInflight = false;
|
||||
var delta = Math.max(0,300-(Date.now()-startTime));
|
||||
setTimeout(function() {
|
||||
$(".deploy-button-content").css('opacity',1);
|
||||
$(".deploy-button-spinner").hide();
|
||||
$(".red-ui-deploy-button-content").css('opacity',1);
|
||||
$(".red-ui-deploy-button-spinner").hide();
|
||||
$("#red-ui-header-shade").hide();
|
||||
$("#red-ui-editor-shade").hide();
|
||||
$("#red-ui-palette-shade").hide();
|
||||
@@ -314,7 +314,7 @@ RED.deploy = (function() {
|
||||
});
|
||||
}
|
||||
function save(skipValidation,force) {
|
||||
if (!$("#btn-deploy").hasClass("disabled")) {
|
||||
if (!$("#red-ui-header-button-deploy").hasClass("disabled")) {
|
||||
if (!RED.user.hasPermission("flows.write")) {
|
||||
RED.notify(RED._("user.errors.deploy"),"error");
|
||||
return;
|
||||
@@ -411,9 +411,9 @@ RED.deploy = (function() {
|
||||
var nns = RED.nodes.createCompleteNodeSet();
|
||||
|
||||
var startTime = Date.now();
|
||||
$(".deploy-button-content").css('opacity',0);
|
||||
$(".deploy-button-spinner").show();
|
||||
$("#btn-deploy").addClass("disabled");
|
||||
$(".red-ui-deploy-button-content").css('opacity',0);
|
||||
$(".red-ui-deploy-button-spinner").show();
|
||||
$("#red-ui-header-button-deploy").addClass("disabled");
|
||||
|
||||
var data = {flows:nns};
|
||||
|
||||
@@ -476,7 +476,7 @@ RED.deploy = (function() {
|
||||
RED.events.emit("deploy");
|
||||
}).fail(function(xhr,textStatus,err) {
|
||||
RED.nodes.dirty(true);
|
||||
$("#btn-deploy").removeClass("disabled");
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
if (xhr.status === 401) {
|
||||
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
|
||||
} else if (xhr.status === 409) {
|
||||
@@ -490,8 +490,8 @@ RED.deploy = (function() {
|
||||
deployInflight = false;
|
||||
var delta = Math.max(0,300-(Date.now()-startTime));
|
||||
setTimeout(function() {
|
||||
$(".deploy-button-content").css('opacity',1);
|
||||
$(".deploy-button-spinner").hide();
|
||||
$(".red-ui-deploy-button-content").css('opacity',1);
|
||||
$(".red-ui-deploy-button-spinner").hide();
|
||||
$("#red-ui-header-shade").hide();
|
||||
$("#red-ui-editor-shade").hide();
|
||||
$("#red-ui-palette-shade").hide();
|
||||
|
@@ -205,7 +205,7 @@ RED.library = (function() {
|
||||
'<a id="node-input-'+options.type+'-lookup" class="editor-button"><i class="fa fa-book"></i> <i class="fa fa-caret-down"></i></a>'+
|
||||
'</div>'
|
||||
|
||||
// '<ul class="dropdown-menu pull-right" role="menu">'+
|
||||
// '<ul class="red-ui-menu-dropdown pull-right" role="menu">'+
|
||||
// '<li><a id="node-input-'+options.type+'-menu-open-library" tabindex="-1" href="#">'+RED._("library.openLibrary")+'</a></li>'+
|
||||
// '<li><a id="node-input-'+options.type+'-menu-save-library" tabindex="-1" href="#">'+RED._("library.saveToLibrary")+'</a></li>'+
|
||||
// '</ul></div>'
|
||||
|
@@ -178,9 +178,9 @@ RED.user = (function() {
|
||||
}
|
||||
|
||||
function updateUserMenu() {
|
||||
$("#btn-usermenu-submenu li").remove();
|
||||
$("#red-ui-header-button-user-submenu li").remove();
|
||||
if (RED.settings.user.anonymous) {
|
||||
RED.menu.addItem("btn-usermenu",{
|
||||
RED.menu.addItem("red-ui-header-button-user",{
|
||||
id:"usermenu-item-login",
|
||||
label:RED._("menu.label.login"),
|
||||
onselect: function() {
|
||||
@@ -194,11 +194,11 @@ RED.user = (function() {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
RED.menu.addItem("btn-usermenu",{
|
||||
RED.menu.addItem("red-ui-header-button-user",{
|
||||
id:"usermenu-item-username",
|
||||
label:"<b>"+RED.settings.user.username+"</b>"
|
||||
});
|
||||
RED.menu.addItem("btn-usermenu",{
|
||||
RED.menu.addItem("red-ui-header-button-user",{
|
||||
id:"usermenu-item-logout",
|
||||
label:RED._("menu.label.logout"),
|
||||
onselect: function() {
|
||||
@@ -213,7 +213,7 @@ RED.user = (function() {
|
||||
if (RED.settings.user) {
|
||||
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
|
||||
|
||||
var userMenu = $('<li><a id="btn-usermenu" class="button hide" href="#"></a></li>')
|
||||
var userMenu = $('<li><a id="red-ui-header-button-user" class="button hide" href="#"></a></li>')
|
||||
.prependTo(".red-ui-header-toolbar");
|
||||
if (RED.settings.user.image) {
|
||||
$('<span class="user-profile"></span>').css({
|
||||
@@ -223,7 +223,7 @@ RED.user = (function() {
|
||||
$('<i class="fa fa-user"></i>').appendTo(userMenu.find("a"));
|
||||
}
|
||||
|
||||
RED.menu.init({id:"btn-usermenu",
|
||||
RED.menu.init({id:"red-ui-header-button-user",
|
||||
options: []
|
||||
});
|
||||
updateUserMenu();
|
||||
|
Reference in New Issue
Block a user