2016-08-05 06:57:53 +00:00
|
|
|
|
(global => {
|
|
|
|
|
global.gl = global.gl || {};
|
2016-08-03 21:45:38 +00:00
|
|
|
|
|
2016-08-05 06:57:53 +00:00
|
|
|
|
gl.ProtectedBranchAccessDropdown = class {
|
|
|
|
|
constructor(options) {
|
|
|
|
|
const { $dropdown, data, onSelect } = options;
|
|
|
|
|
|
|
|
|
|
$dropdown.glDropdown({
|
|
|
|
|
data: data,
|
|
|
|
|
selectable: true,
|
2016-08-05 22:04:10 +00:00
|
|
|
|
inputId: $dropdown.data('input-id'),
|
2016-08-05 06:57:53 +00:00
|
|
|
|
fieldName: $dropdown.data('field-name'),
|
2016-08-21 05:21:32 +00:00
|
|
|
|
toggleLabel(item, el) {
|
|
|
|
|
if (el.is('.is-active')) {
|
|
|
|
|
return item.text;
|
|
|
|
|
} else {
|
|
|
|
|
return 'Select';
|
|
|
|
|
}
|
2016-08-05 06:57:53 +00:00
|
|
|
|
},
|
|
|
|
|
clicked(item, $el, e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
onSelect();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-08-03 21:45:38 +00:00
|
|
|
|
}
|
2016-08-05 06:57:53 +00:00
|
|
|
|
|
|
|
|
|
})(window);
|