Gitlab CSE Unil

axis_del_form.mustache 3.61 KB
Newer Older
1
{{!
M. Chardon's avatar
M. Chardon committed
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
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template assignfeedback_editpdfplus/axis_del_form

    Admin template for remove one axis.

    Context variables required for this template:
    * courseid - Course id
    * title - Title of the page (add or edit)
    * render - form render for removing the axis
    * id - form id
27
28
29
30
31
32
33
}}

<div class="panel panel-default">
    <div class="panel-heading">
        {{title}}
    </div>
    <div class="panel-body" style="text-align: center;">
M. Chardon's avatar
M. Chardon committed
34
        <p>{{# str }} adminaxisdelete_question, assignfeedback_editpdfplus {{/ str }}</p>
35
        {{{render}}}
M. Chardon's avatar
M. Chardon committed
36
37
        <button type="button" class="btn btn-primary" id="axisDelSubmit">{{# str }} adminaxisdelete_ok, assignfeedback_editpdfplus {{/ str }}</button>
        <button type="button" class="btn btn-default" id="axisDelCancel">{{# str }} adminaxisdelete_ko, assignfeedback_editpdfplus {{/ str }}</button>
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
    </div>
</div>
{{# js }}
require(['jquery','core/ajax','core/notification'], function($,ajax,notification) {
    var formid='{{id}}';
    $("#axisDelSubmit").on("click", function () {
        var form = $('#'+formid);
        var data = form.serialize()+"&courseid="+{{courseid}};
        ajax.call([
            {
                methodname: 'assignfeedback_editpdfplus_submit_axis_del_form',
                args: {jsonformdata: JSON.stringify(data)}
            }
        ])[0].done(function(message) {
            if (message[0].message === "1"){
                $('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body').html("");
                $("#editpdlplus_axes option:selected").remove();
                $("#editpdlplus_axes").change();
                $("#axistool").show();
            }else{
                $('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body > .panel > .panel-body').append("<div class='alert alert-danger' style='margin-top: 5px;'>"+message[0].message+"</div>");
            }
60
61
62
63
64
65
66
67
68
69
            var selectAxis = $("#editpdlplus_axes").val();
            if (selectAxis && selectAxis !== "") {
                $("#axistool").show();
                $('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
                $('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
            } else {
                $("#assignfeedback_editpdfplus_widget_admin_workspace").hide();
                $('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
                $('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
            }
70
            $("#editpdlplus_axes").prop('disabled',false);
71
72
73
74
75
        }).fail(notification.exception);
    });
    $("#axisDelCancel").on("click", function () {
        $('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body').html("");
        $("#axistool").show();
M. Chardon's avatar
M. Chardon committed
76
77
        $('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
        $('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
78
        $("#editpdlplus_axes").prop('disabled',false);
79
80
81
    });
});
{{/ js }}