Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// This file is part of Moodle - http://moodle.org/
2
//
3
// Moodle is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
7
//
8
// Moodle is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
/**
17
 * Edit items in feedback module
18
 *
19
 * @module     mod_feedback/edit
20
 * @copyright  2016 Marina Glancy
21
 */
22
define(['jquery', 'core/ajax', 'core/str', 'core/notification'],
23
function($, ajax, str, notification) {
24
    var manager = {
25
        deleteItem: function(e) {
26
            e.preventDefault();
27
            var targetUrl = $(e.currentTarget).attr('href');
28
 
29
            str.get_strings([
30
                {
31
                    key:        'confirmation',
32
                    component:  'admin'
33
                },
34
                {
35
                    key:        'confirmdeleteitem',
36
                    component:  'mod_feedback'
37
                },
38
                {
39
                    key:        'yes',
40
                    component:  'moodle'
41
                },
42
                {
43
                    key:        'no',
44
                    component:  'moodle'
45
                }
46
            ])
47
            .then(function(s) {
48
                notification.confirm(s[0], s[1], s[2], s[3], function() {
49
                    window.location = targetUrl;
50
                });
51
 
52
                return;
53
            })
54
            .catch();
55
        },
56
 
57
        setup: function() {
58
            $('body').delegate('[data-action="delete"]', 'click', manager.deleteItem);
59
        }
60
    };
61
 
62
    return {
63
        setup: manager.setup
64
    };
65
});