| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 21 |
| Ratio | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | View Code Duplication | $('i.glyphicon-refresh-animate').hide(); |
|
| 29 | function search(target) { |
||
| 30 | var $list = $('select.list[data-target="' + target + '"]'); |
||
| 31 | $list.html(''); |
||
| 32 | var q = $('.search[data-target="' + target + '"]').val(); |
||
| 33 | |||
| 34 | var groups = { |
||
| 35 | role: [$('<optgroup label="Roles">'), false], |
||
| 36 | permission: [$('<optgroup label="Permission">'), false], |
||
| 37 | }; |
||
| 38 | $.each(_opts.items[target], function (name, group) { |
||
| 39 | if (name.indexOf(q) >= 0) { |
||
| 40 | $('<option>').text(name).val(name).appendTo(groups[group][0]); |
||
| 41 | groups[group][1] = true; |
||
| 42 | } |
||
| 43 | }); |
||
| 44 | $.each(groups, function () { |
||
| 45 | if (this[1]) { |
||
| 46 | $list.append(this[0]); |
||
| 47 | } |
||
| 48 | }); |
||
| 49 | } |
||
| 50 | |||
| 54 |
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.