mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Use new tab style for sidebar
This commit is contained in:
@@ -15,7 +15,30 @@
|
||||
**/
|
||||
RED.sidebar = function() {
|
||||
|
||||
$('#sidebar').tabs();
|
||||
//$('#sidebar').tabs();
|
||||
var sidebar_tabs = RED.tabs.create({
|
||||
id:"sidebar-tabs",
|
||||
onchange:function(id) {
|
||||
$("#sidebar-content").children().hide();
|
||||
$("#"+id).show();
|
||||
}
|
||||
});
|
||||
function addTab(title,content) {
|
||||
$("#sidebar-content").append(content);
|
||||
$(content).hide();
|
||||
sidebar_tabs.addTab({id:"tab-"+title,label:title});
|
||||
//content.style.position = "absolute";
|
||||
//$('#sidebar').tabs("refresh");
|
||||
}
|
||||
|
||||
var content = document.createElement("div");
|
||||
content.id = "tab-info";
|
||||
content.style.paddingTop = "4px";
|
||||
content.style.paddingLeft = "4px";
|
||||
content.style.paddingRight = "4px";
|
||||
|
||||
addTab("info",content);
|
||||
sidebar_tabs.activateTab("tab-info");
|
||||
|
||||
$('#btn-sidebar').click(function() {toggleSidebar();});
|
||||
RED.keyboard.add(/* SPACE */ 32,{ctrl:true},function(){toggleSidebar();d3.event.preventDefault();});
|
||||
@@ -50,6 +73,7 @@ RED.sidebar = function() {
|
||||
sidebarSeparator.closing = false;
|
||||
$("#sidebar").removeClass("closing");
|
||||
}
|
||||
sidebar_tabs.resize();
|
||||
RED.view.resize();
|
||||
|
||||
},
|
||||
@@ -64,9 +88,9 @@ RED.sidebar = function() {
|
||||
});
|
||||
|
||||
function toggleSidebar() {
|
||||
if ($('#sidebar').tabs( "option", "active" ) === false) {
|
||||
$('#sidebar').tabs( "option", "active",0);
|
||||
}
|
||||
//if ($('#sidebar').tabs( "option", "active" ) === false) {
|
||||
// $('#sidebar').tabs( "option", "active",0);
|
||||
//}
|
||||
var btnSidebar = $("#btn-sidebar");
|
||||
btnSidebar.toggleClass("active");
|
||||
|
||||
@@ -78,15 +102,6 @@ RED.sidebar = function() {
|
||||
}
|
||||
toggleSidebar();
|
||||
|
||||
function addTab(title,content) {
|
||||
var tab = document.createElement("li");
|
||||
tab.innerHTML = '<a href="#tab-'+title+'">'+title+'</a>';
|
||||
$("#sidebar-tabs").append(tab);
|
||||
$("#sidebar-content").append(content);
|
||||
|
||||
$('#sidebar').tabs("refresh");
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
addTab: addTab
|
||||
|
Reference in New Issue
Block a user