-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_reports.js
30 lines (24 loc) · 1010 Bytes
/
custom_reports.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Drupal.behaviors.custom_reports_list_form = function(context) {
// When the report switches
$('#custom-reports-list-form input[name=report]').click(function() {
selected = $('input[name=report]:checked').val();
// Show "run as test" for storable reports
if ($.inArray(selected, Drupal.settings.custom_reports_storable) != -1) {
$('#edit-test-wrapper').show();
} else {
$('#edit-test-wrapper').hide();
}
// Hide all additional form elements
$.each(Drupal.settings.custom_reports_elements, function(i, value) {
$.each(value, function(i, value2) {
$('#edit-' + value2.replace(/_/g, '-') + '-wrapper').hide();
});
});
// Show specific additional form elements
if (Drupal.settings.custom_reports_elements[selected] != undefined) {
$.each(Drupal.settings.custom_reports_elements[selected], function(i, value) {
$('#edit-' + value.replace(/_/g, '-') + '-wrapper').show();
});
}
}).triggerHandler('click');
};