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

27 lines
607 B
JavaScript
Raw Normal View History

2017-09-10 17:25:29 +05:30
export default class ProtectedBranchAccessDropdown {
constructor(options) {
this.options = options;
this.initDropdown();
}
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
initDropdown() {
const { $dropdown, data, onSelect } = this.options;
$dropdown.glDropdown({
data,
selectable: true,
inputId: $dropdown.data('input-id'),
fieldName: $dropdown.data('field-name'),
toggleLabel(item, $el) {
if ($el.is('.is-active')) {
return item.text;
2016-09-13 17:45:13 +05:30
}
2017-09-10 17:25:29 +05:30
return 'Select';
},
clicked(options) {
options.e.preventDefault();
onSelect();
},
});
}
}