Revision 5dc52783 snf-cyclades-app/synnefo/helpdesk/static/js/common.js
b/snf-cyclades-app/synnefo/helpdesk/static/js/common.js | ||
---|---|---|
31 | 31 |
|
32 | 32 |
// hide/show expand/collapse |
33 | 33 |
|
34 |
$('.subnav a').click(function(){ |
|
34 |
$('.subnav .dropdown-menu a').click(function(){
|
|
35 | 35 |
$('.info-block-content, .show-hide-all').show(); |
36 | 36 |
}) |
37 | 37 |
|
38 |
function checkBadgeExpanded(el){ |
|
39 |
if (el.hasClass('expanded')){ |
|
40 |
el.html( txt_tab[1]); |
|
41 |
} else { |
|
42 |
el.html( txt_tab[0]); |
|
43 |
} |
|
44 |
} |
|
45 | 38 |
|
46 |
var txt_tab = ['+ Show Info','- Hide Info']; |
|
39 |
|
|
47 | 40 |
var txt_all = ['+ Expand all','- Collapse all']; |
48 | 41 |
|
49 |
$('.show-hide-tabs span').html(txt_tab[0]); |
|
42 |
|
|
50 | 43 |
$('.show-hide-all span').html(txt_all[0]); |
51 | 44 |
|
52 | 45 |
|
53 | 46 |
$('.show-hide-all').click(function(){ |
54 | 47 |
var badgeAll = $(this).children('span'); |
55 |
var tabs = $(this).parents('.info-block').find('.show-hide-tabs'); |
|
56 | 48 |
badgeAll.toggleClass('open'); |
49 |
var tabs = $(this).parent('.info-block').find('.object-details-content') |
|
57 | 50 |
|
51 |
console.info(tabs); |
|
58 | 52 |
if (badgeAll.hasClass('open')){ |
59 | 53 |
badgeAll.html( txt_all[1]); |
60 | 54 |
tabs.each(function() { |
61 |
$(this).next().show('slow'); |
|
62 |
$(this).children('span').addClass('expanded'); |
|
63 |
checkBadgeExpanded($(this).children('span')); |
|
55 |
$(this).show(); |
|
56 |
$(this).siblings('h4').addClass('expanded'); |
|
64 | 57 |
}); |
65 | 58 |
|
66 | 59 |
|
67 | 60 |
} else { |
68 | 61 |
badgeAll.html( txt_all[0]); |
69 | 62 |
tabs.each(function() { |
70 |
$(this).next().hide('slow');
|
|
71 |
$(this).children('span').removeClass('expanded');
|
|
72 |
checkBadgeExpanded($(this).children('span')); |
|
63 |
$(this).hide();
|
|
64 |
$(this).siblings('h4').removeClass('expanded');
|
|
65 |
|
|
73 | 66 |
}); |
74 | 67 |
} |
75 | 68 |
|
76 | 69 |
|
77 | 70 |
}); |
78 | 71 |
|
79 |
|
|
80 |
$('.show-hide-tabs').click(function(){ |
|
72 |
|
|
73 |
|
|
74 |
$('.object-details h4').click(function(){ |
|
81 | 75 |
|
82 |
$(this).next().toggle('slow'); |
|
83 |
var badge = $(this).children('span'); |
|
84 |
badge.toggleClass('expanded'); |
|
85 |
checkBadgeExpanded(badge); |
|
86 |
|
|
76 |
$(this).siblings('.object-details-content').toggle(); |
|
77 |
$(this).toggleClass('expanded'); |
|
78 |
|
|
87 | 79 |
}); |
88 | 80 |
|
81 |
|
|
89 | 82 |
$('.info-block h3').click(function(){ |
90 | 83 |
$(this).next('.info-block-content').toggle(); |
91 | 84 |
$(this).prev('.show-hide-all').toggle(); |
92 | 85 |
}) |
86 |
|
|
93 | 87 |
|
94 | 88 |
}) |
95 | 89 |
|
Also available in: Unified diff