Completed
Push — wip-platform ( 7a0832...03cba6 )
by
unknown
07:10 queued 03:56
created

Resources/public/js/deleteCheckboxCollection.js   A

Complexity

Total Complexity 4
Complexity/F 4

Size

Lines of Code 21
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
dl 0
loc 21
rs 10
cc 0
nc 1
mnd 2
bc 5
fnc 1
bpm 5
cpm 4
noi 1
1
$(document).on('ifChecked','.sonata-ba-field-inline-natural input[type="checkbox"], .sonata-ba-field-inline-table input[type="checkbox"]',function(e) {
2
    var input = $(this);
3
    var name = input.attr('name');
4
5
    if(name.match(/\[[0-9]*\]\[_delete\]/)) {
6
7
        var formRow = input.closest('div.sonata-ba-tabs>div');
8
9
        if(formRow.length == 0) {
10
            formRow = input.closest('tr');
11
        }
12
13
        var r = confirm(Translator.trans('librinfo.confirm.delete_collection_item', {}, 'messages'));
0 ignored issues
show
Bug introduced by
The variable Translator seems to be never declared. If this is a global, consider adding a /** global: Translator */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
14
        if (r == true) {
15
            formRow.remove();
16
        } else {
17
            // throw exception to avoid checkbox checking
18
            e.dummy();
19
        }
20
    }
21
});
22