debian-mirror-gitlab/app/assets/javascripts/protected_branch_access_dropdown.js.es6

29 lines
638 B
JavaScript
Raw Normal View History

2016-09-13 17:45:13 +05:30
(global => {
global.gl = global.gl || {};
gl.ProtectedBranchAccessDropdown = class {
constructor(options) {
const { $dropdown, data, onSelect } = options;
$dropdown.glDropdown({
data: data,
selectable: true,
inputId: $dropdown.data('input-id'),
fieldName: $dropdown.data('field-name'),
toggleLabel(item, el) {
if (el.is('.is-active')) {
return item.text;
} else {
return 'Select';
}
},
clicked(item, $el, e) {
e.preventDefault();
onSelect();
}
});
}
}
})(window);