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