debian-mirror-gitlab/app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js

29 lines
679 B
JavaScript
Raw Normal View History

2019-07-31 22:56:46 +05:30
import { __ } from '~/locale';
2017-08-17 22:00:37 +05:30
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,
2018-03-27 19:54:05 +05:30
inputId: this.options.$dropdown.data('inputId'),
fieldName: this.options.$dropdown.data('fieldName'),
2017-08-17 22:00:37 +05:30
toggleLabel(item, $el) {
if ($el.is('.is-active')) {
return item.text;
}
2019-07-31 22:56:46 +05:30
return __('Select');
2017-08-17 22:00:37 +05:30
},
clicked(options) {
options.e.preventDefault();
onSelect();
},
});
}
}