summaryrefslogtreecommitdiff
path: root/assets/js/src/Subtask.js
blob: c6cae641640c3552b5e7e9987e3828dd7c7934e7 (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
34
function Subtask() {
}

Subtask.prototype.listen = function() {
    $(document).on("click", ".subtask-toggle-status", function(e) {
        e.preventDefault();
        var el = $(this);

        $.ajax({
            cache: false,
            url: el.attr("href"),
            success: function(data) {
                if (el.hasClass("subtask-refresh-table")) {
                    $(".subtasks-table").replaceWith(data);
                } else {
                    el.replaceWith(data);
                }
            }
        });
    });

    $(document).on("click", ".subtask-toggle-timer", function(e) {
        e.preventDefault();
        var el = $(this);

        $.ajax({
            cache: false,
            url: el.attr("href"),
            success: function(data) {
                $(".subtasks-table").replaceWith(data);
            }
        });
    });
};