summaryrefslogtreecommitdiff
path: root/public/assets/js/_dependency-control/utils/confirm.js
blob: ef59cbbc1d7eb419f73f6bf4ee5965b8e9a153a6 (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
define(function () {
    return function (options, callback) {
        var $dialog = $(options.template instanceof jQuery ? options.template.html() : options.template);
        $dialog.hide();
        $('body').append($dialog);
        $dialog.parseAttributePlugins();

        function close() {
            $dialog.remove();
        }

        function open() {
            $dialog.show();
        }

        open();
        $dialog.find('.button.yes').click(function (e) {
            e.preventDefault();
            close();
            callback();
        });
        $dialog.find('.button.no').click(function (e) {
            e.preventDefault();
            close();
        });
    };
});