aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap/inline-editing.js
blob: 8f96f31410efd320a0de86e40f274bc741a6d4db (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
jQuery(
    function () {

        jQuery(document).ready(
            function() {
                var elements = jQuery('[data-inline-editing]');
                for (const element of elements) {
                    STUDIP.InlineEditing.init(element);
                }
            }
        );

        jQuery(document).on(
            'dialog-update',
            null,
            function() {
                var elements = jQuery('.ui-dialog [data-inline-editing]');
                for (const element of elements) {
                    STUDIP.InlineEditing.init(element);
                }
            }
        );

        jQuery(document).on(
            'click',
            '[data-inline-editing] .edit-button',
            function (event) {
                STUDIP.InlineEditing.activate(event.target);
            }
        );

        jQuery(document).on(
            'click',
            '[data-inline-editing] .save-button',
            function (event) {
                STUDIP.InlineEditing.save(event.target);
            }
        );

        jQuery(document).on(
            'click',
            '[data-inline-editing] .abort-button',
            function (event) {
                STUDIP.InlineEditing.abort(event.target);
            }
        );
    }
);