Test Setup Failed
Push — master ( cd1dab...2a689d )
by
unknown
03:51
created

PaymentDeleteAction   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
define([
2
    'underscore',
3
    'oroui/js/messenger',
4
    'orotranslation/js/translator',
5
    'oroui/js/delete-confirmation',
6
    'oro/datagrid/action/delete-action'
7
], function(_, messenger, __, DeleteConfirmation, DeleteAction) {
8
    'use strict';
9
10
    var PaymentDeleteAction;
11
12
    /**
13
     * Delete action with confirm dialog, triggers REST DELETE request
14
     *
15
     * @export  oro/datagrid/action/payment_delete-action
16
     * @class   oro.datagrid.action.PaymentDeleteAction
17
     * @extends oro.datagrid.action.DeleteAction
18
     */
19
    PaymentDeleteAction = DeleteAction.extend({
20
21
        /** @property {Function} */
22
        confirmModalConstructor: DeleteConfirmation,
23
24
        /** @property {String} */
25
        confirm_content: __('Are you sure you want to delete this item?'),
26
27
        /**
28
         * @inheritDoc
29
         */
30
        constructor: function PaymentDeleteAction() {
31
            PaymentDeleteAction.__super__.constructor.apply(this, arguments);
32
        },
33
34
        /**
35
         * @inheritDoc
36
         */
37
        initialize: function(options) {
0 ignored issues
show
Unused Code introduced by
The parameter options is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
38
            if (this.model.has('payment_delete_message')) {
39
                this.confirm_content = this.model.get('payment_delete_message');
40
            }
41
42
            DeleteAction.__super__.initialize.apply(this, arguments);
43
        },
44
45
        /**
46
         * Get view for confirm modal
47
         *
48
         * @return {oroui.Modal}
49
         */
50
        getConfirmDialog: function(callback) {
51
            if (!this.confirmModal) {
52
                this.confirmModal = (new this.confirmModalConstructor({
53
                    title: __(this.messages.confirm_title),
54
                    content: this.confirm_content,
55
                    okText: __(this.messages.confirm_ok),
56
                    cancelText: __(this.messages.confirm_cancel)
57
                }));
58
                this.listenTo(this.confirmModal, 'ok', callback);
59
60
                this.subviews.push(this.confirmModal);
61
            }
62
            return this.confirmModal;
63
        }
64
    });
65
66
    return PaymentDeleteAction;
67
});
68