mirror of https://github.com/apache/cloudstack.git
new UI - add a new shared function: switchBetweenDifferentTabs()
This commit is contained in:
parent
f6bd092327
commit
58a6296913
|
|
@ -632,31 +632,11 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||
zIndex: 2000
|
||||
}));
|
||||
|
||||
//***** switch to different tab (begin) ********************************************************************
|
||||
$("#tab_details").bind("click", function(event){
|
||||
$(this).removeClass("off").addClass("on");
|
||||
$("#tab_volume, #tab_statistics").removeClass("on").addClass("off");
|
||||
$("#tab_content_details").show();
|
||||
$("#tab_content_volume, #tab_content_statistics").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#tab_volume").bind("click", function(event){
|
||||
$(this).removeClass("off").addClass("on");
|
||||
$("#tab_details, #tab_statistics").removeClass("on").addClass("off");
|
||||
$("#tab_content_volume").show();
|
||||
$("#tab_content_details, #tab_content_statistics").hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#tab_statistics").bind("click", function(event){
|
||||
$(this).removeClass("off").addClass("on");
|
||||
$("#tab_details, #tab_volume").removeClass("on").addClass("off");
|
||||
$("#tab_content_statistics").show();
|
||||
$("#tab_content_details, #tab_content_volume").hide();
|
||||
return false;
|
||||
});
|
||||
//***** switch to different tab (end) **********************************************************************
|
||||
//***** switch between different tabs (begin) ********************************************************************
|
||||
var tabArray = ["tab_details", "tab_volume", "tab_statistics"];
|
||||
var tabContentArray = ["tab_content_details", "tab_content_volume", "tab_content_statistics"];
|
||||
switchBetweenDifferentTabs(tabArray, tabContentArray);
|
||||
//***** switch between different tabs (end) **********************************************************************
|
||||
|
||||
//***** VM Wizard (begin) ******************************************************************************
|
||||
$vmPopup = $("#vm_popup");
|
||||
|
|
|
|||
|
|
@ -664,6 +664,28 @@ function initializeEditFunction($readonlyFields, $editFields, doUpdateFn) {
|
|||
});
|
||||
}
|
||||
|
||||
function switchBetweenDifferentTabs(tabArray, tabContentArray) {
|
||||
for(var tabIndex=0; tabIndex<tabArray.length; tabIndex++) {
|
||||
switchToTab(tabIndex, tabArray, tabContentArray);
|
||||
}
|
||||
}
|
||||
|
||||
function switchToTab(tabIndex, tabArray, tabContentArray) {
|
||||
$("#"+tabArray[tabIndex]).bind("click", function(event){
|
||||
$("#"+tabArray[tabIndex]).removeClass("off").addClass("on"); //current tab turns on
|
||||
for(var k=0; k<tabArray.length; k++) {
|
||||
if(k != tabIndex)
|
||||
$("#"+tabArray[k]).removeClass("on").addClass("off"); //other tabs turns off
|
||||
}
|
||||
|
||||
$("#"+tabContentArray[tabIndex]).show(); //current tab content shows
|
||||
for(var k=0; k<tabContentArray.length; k++) {
|
||||
if(k != tabIndex)
|
||||
$("#"+tabContentArray[k]).hide(); //other tab content hide
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue