Revision 48c5ca09 snf-cyclades-app/synnefo/helpdesk/static/js/common.js
b/snf-cyclades-app/synnefo/helpdesk/static/js/common.js | ||
---|---|---|
27 | 27 |
|
28 | 28 |
$win.on('scroll', processScroll) |
29 | 29 |
|
30 |
|
|
31 |
|
|
30 |
|
|
31 |
|
|
32 |
// hide/show expand/collapse |
|
33 |
|
|
34 |
$('.subnav a').click(function(){ |
|
35 |
$('.info-block-content, .show-hide-all').show(); |
|
36 |
}) |
|
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 |
|
|
46 |
var txt_tab = ['+ Show Info','- Hide Info']; |
|
47 |
var txt_all = ['+ Expand all','- Collapse all']; |
|
48 |
|
|
49 |
$('.show-hide-tabs span').html(txt_tab[0]); |
|
50 |
$('.show-hide-all span').html(txt_all[0]); |
|
51 |
|
|
52 |
|
|
53 |
$('.show-hide-all').click(function(){ |
|
54 |
var badgeAll = $(this).children('span'); |
|
55 |
var tabs = $(this).parents('.info-block').find('.show-hide-tabs'); |
|
56 |
badgeAll.toggleClass('open'); |
|
57 |
|
|
58 |
if (badgeAll.hasClass('open')){ |
|
59 |
badgeAll.html( txt_all[1]); |
|
60 |
tabs.each(function() { |
|
61 |
$(this).next().show('slow'); |
|
62 |
$(this).children('span').addClass('expanded'); |
|
63 |
checkBadgeExpanded($(this).children('span')); |
|
64 |
}); |
|
65 |
|
|
66 |
|
|
67 |
} else { |
|
68 |
badgeAll.html( txt_all[0]); |
|
69 |
tabs.each(function() { |
|
70 |
$(this).next().hide('slow'); |
|
71 |
$(this).children('span').removeClass('expanded'); |
|
72 |
checkBadgeExpanded($(this).children('span')); |
|
73 |
}); |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
}); |
|
78 |
|
|
79 |
|
|
80 |
$('.show-hide-tabs').click(function(){ |
|
81 |
|
|
82 |
$(this).next().toggle('slow'); |
|
83 |
var badge = $(this).children('span'); |
|
84 |
badge.toggleClass('expanded'); |
|
85 |
checkBadgeExpanded(badge); |
|
86 |
|
|
87 |
}); |
|
88 |
|
|
89 |
$('.info-block h3').click(function(){ |
|
90 |
$(this).next('.info-block-content').toggle(); |
|
91 |
$(this).prev('.show-hide-all').toggle(); |
|
92 |
}) |
|
32 | 93 |
|
33 | 94 |
}) |
34 | 95 |
|
Also available in: Unified diff