gitlab-org--gitlab-foss/app/assets/javascripts/issue_status_select.js

28 lines
756 B
JavaScript
Raw Normal View History

import $ from 'jquery';
import { __ } from './locale';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
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');
initDeprecatedJQueryDropdown($(el), {
selectable: true,
fieldName,
2017-10-31 07:27:50 -04:00
toggleLabel(selected, element, instance) {
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;
},
clicked(options) {
return options.e.preventDefault();
},
2017-10-31 07:27:50 -04:00
id(obj, element) {
return $(element).data('id');
},
});
});
}