Revision 34d12b31 snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js | ||
---|---|---|
27 | 27 |
} |
28 | 28 |
} |
29 | 29 |
|
30 |
/* sets lt-sidebar height. Useful for jscrollpane scrollbar */ |
|
31 |
ui.setSidebarHeight = function(){ |
|
30 |
/* Sets mainArea min-height |
|
31 |
* Used for .details div |
|
32 |
*/ |
|
33 |
ui.setElminHeight = function(el){ |
|
32 | 34 |
var WindowHeight = $(window).height(); |
33 |
var h1= WindowHeight - $('.header').outerHeight();
|
|
34 |
var h2= $('.main').outerHeight();
|
|
35 |
$('.lt-sidebar').height((h2>h1) ? h2 : h1);
|
|
36 |
$('.lt-bar').height((h2>h1) ? h2 : h1);
|
|
35 |
var header = $('.header').outerHeight();
|
|
36 |
var actions = $('.actions').outerHeight();
|
|
37 |
var h1= WindowHeight - (header+actions);
|
|
38 |
el.css('min-height', h1);
|
|
37 | 39 |
} |
38 | 40 |
|
39 | 41 |
|
... | ... | |
89 | 91 |
}) |
90 | 92 |
} |
91 | 93 |
|
92 |
ui.detailsLastCustom = function() { |
|
93 |
|
|
94 |
// details connected related js |
|
94 |
ui.detailsCustom = function() { |
|
95 |
// position last connected item |
|
95 | 96 |
var el = $('.connected .item').last(); |
96 | 97 |
// -2 is the border width; |
97 | 98 |
var moveY = el.find('.connections >li').last().outerHeight(true) -2; |
98 | 99 |
el.css('top',moveY); |
99 | 100 |
el.css('marginTop', -moveY); |
100 |
//el.css('margin-top') |
|
101 | 101 |
} |
102 | 102 |
|
103 | 103 |
ui.firewallSetup = function(){ |
... | ... | |
288 | 288 |
}); |
289 | 289 |
} |
290 | 290 |
|
291 |
|
|
292 |
/* Tabs functionality |
|
293 |
* tabsEl is the div/ul with the links to the sections and the sections that |
|
294 |
* with toggle have class sectionEl. |
|
295 |
* Markup needed is an href to each a with the id of the relative section. |
|
296 |
*/ |
|
297 |
ui.tabs = function(tabsEl, sectionEl) { |
|
298 |
var tabLink = tabsEl.find('a'); |
|
299 |
function href(a) { |
|
300 |
return a.attr('href'); |
|
301 |
} |
|
302 |
tabLink.click(function(e){ |
|
303 |
e.preventDefault(); |
|
304 |
if ( $(this).hasClass('active')){ |
|
305 |
return false; |
|
306 |
} else { |
|
307 |
$(this).parents(tabsEl).find('a').removeClass('active'); |
|
308 |
$(this).addClass('active'); |
|
309 |
$(sectionEl).hide(); |
|
310 |
$(href($(this))).stop(true,true).slideDown(500); |
|
311 |
} |
|
312 |
|
|
313 |
}) |
|
314 |
} |
|
315 |
|
|
291 | 316 |
$(document).ready(function(){ |
292 | 317 |
|
293 | 318 |
if($('.vms.entities').length!=0){ |
294 | 319 |
ui.inactiveActions(); |
295 | 320 |
}; |
296 |
ui.setSidebarHeight();
|
|
321 |
ui.setElminHeight($('.details'));
|
|
297 | 322 |
$('#hd-search .hd-icon-search').click(function(e){ |
298 | 323 |
var that = this; |
299 | 324 |
$(this).parents('.hd-search').toggleClass('hd-open'); |
... | ... | |
553 | 578 |
}); |
554 | 579 |
|
555 | 580 |
// connected details js |
556 |
ui.detailsLastCustom();
|
|
581 |
ui.detailsCustom(); |
|
557 | 582 |
ui.firewallSetup(); |
558 | 583 |
$('.firewall .more a').click(function(e){ |
559 | 584 |
e.preventDefault(); |
... | ... | |
573 | 598 |
$('.firewall').mouseleave(function(e){ |
574 | 599 |
$(this).find('.more').stop(true, true).slideUp(200); |
575 | 600 |
}); |
601 |
ui.tabs($('.tabs'), $('.content')); |
|
576 | 602 |
// end of connected details js |
577 | 603 |
}) |
578 | 604 |
|
579 | 605 |
|
580 | 606 |
$(window).resize(function(e){ |
581 |
ui.setSidebarHeight();
|
|
607 |
ui.setElminHeight($('.details'));
|
|
582 | 608 |
$('.scroll-pane').jScrollPane(); |
583 | 609 |
}) |
Also available in: Unified diff