aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap/cronjobs.js
blob: 8a6224743c71d976c0b6ae4130aca19d442297b4 (plain)
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
31
32
33
// Cron task: Change tbody class according to inherent input setting
$(document).on('change', '.cron-task input', function() {
    $(this)
        .closest('tbody')
        .addClass('selected')
        .siblings()
        .removeClass('selected');
});

// Cron item:
// Display the following element and focus it's inherent input element
// if no value from a select element has been chosen. Hide the following
// element if a value has been chosen.
$(document).on('change', '.cron-item select', function() {
    var state = $(this).val().length > 0,
        $next = $(this).next();

    if (state) {
        $next
            .show()
            .find('input')
            .focus();
    } else {
        $next.hide();
    }
});

// Active date and time picker as well as the Cron item selector on
// document ready / page load.
STUDIP.domReady(function() {
    $('.cron-item select').change();
    $('.cronjobs tfoot select').change();
});