Passed
Push — master ( e95921...ddbd1b )
by Dimas
13:28 queued 05:15
created

etc/superuser/users/roles.js   A

Complexity

Total Complexity 7
Complexity/F 1.17

Size

Lines of Code 36
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 21
c 0
b 0
f 0
dl 0
loc 36
rs 10
wmc 7
mnd 1
bc 1
fnc 6
bpm 0.1666
cpm 1.1666
noi 2
1
function deleteRole(role) {
2
  console.log(getFuncName(), role);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
3
}
4
AjaxForm();
5
6
jQuery(document).ready(function () {
7
  load_module(["select2"], function () {
8
    var dataSource = [];
9
    /**
10
     * @type {string[]}
11
     */
12
    var dataIntangible = selectOptions;
13
    dataIntangible.forEach(function (data, index) {
14
      dataSource.push({ text: data, id: data });
15
    });
16
    //console.log(dataSource);
17
    jQuery('[id^="select-"]').each(function (index, value) {
18
      jQuery(this).select2({
19
        data: dataSource,
20
        theme: "material",
21
        placeholder: "Select a route",
22
        allowClear: true,
23
        templateSelection: function (data) {
24
          if (data.id === "") {
25
            // adjust for custom placeholder values
26
            return "Custom styled placeholder text";
27
          }
28
29
          return data.text;
30
        },
31
      });
32
      var val = jQuery(this).data("key");
33
      console.log(val);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
34
    });
35
  });
36
});
37