2018-03-09 20:18:59 +00:00
|
|
|
import $ from 'jquery';
|
2019-05-02 14:49:16 +00:00
|
|
|
import { __ } from './locale';
|
2020-08-24 18:10:19 +00:00
|
|
|
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
|
2018-03-09 20:18:59 +00:00
|
|
|
|
2017-10-30 18:59:16 +00:00
|
|
|
export default function issueStatusSelect() {
|
2017-10-31 11:27:50 +00:00
|
|
|
$('.js-issue-status').each((i, el) => {
|
2018-02-20 22:20:48 +00:00
|
|
|
const fieldName = $(el).data('fieldName');
|
2020-08-24 18:10:19 +00:00
|
|
|
initDeprecatedJQueryDropdown($(el), {
|
2017-10-30 18:59:16 +00:00
|
|
|
selectable: true,
|
|
|
|
fieldName,
|
2017-10-31 11:27:50 +00:00
|
|
|
toggleLabel(selected, element, instance) {
|
2019-05-02 14:49:16 +00:00
|
|
|
let label = __('Author');
|
2017-10-31 11:27:50 +00:00
|
|
|
const $item = instance.dropdown.find('.is-active');
|
|
|
|
if ($item.length) {
|
|
|
|
label = $item.text();
|
|
|
|
}
|
|
|
|
return label;
|
|
|
|
},
|
2017-10-30 18:59:16 +00:00
|
|
|
clicked(options) {
|
|
|
|
return options.e.preventDefault();
|
|
|
|
},
|
2017-10-31 11:27:50 +00:00
|
|
|
id(obj, element) {
|
|
|
|
return $(element).data('id');
|
2017-10-30 18:59:16 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|