gitlab-org--gitlab-foss/app/assets/javascripts/protected_tags/protected_tag_access_dropdo...

27 lines
645 B
JavaScript

export default class ProtectedTagAccessDropdown {
constructor(options) {
this.options = options;
this.initDropdown();
}
initDropdown() {
const { onSelect } = this.options;
this.options.$dropdown.glDropdown({
data: this.options.data,
selectable: true,
inputId: this.options.$dropdown.data('input-id'),
fieldName: this.options.$dropdown.data('field-name'),
toggleLabel(item, $el) {
if ($el.is('.is-active')) {
return item.text;
}
return 'Select';
},
clicked(options) {
options.e.preventDefault();
onSelect();
},
});
}
}