debian-mirror-gitlab/app/assets/javascripts/issue_status_select.js

27 lines
671 B
JavaScript
Raw Normal View History

2018-05-09 12:01:36 +05:30
import $ from 'jquery';
2019-09-04 21:01:54 +05:30
import { __ } from './locale';
2018-05-09 12:01:36 +05:30
2018-03-17 18:26:18 +05:30
export default function issueStatusSelect() {
$('.js-issue-status').each((i, el) => {
2018-03-27 19:54:05 +05:30
const fieldName = $(el).data('fieldName');
2018-03-17 18:26:18 +05:30
return $(el).glDropdown({
selectable: true,
fieldName,
toggleLabel(selected, element, instance) {
2019-09-04 21:01:54 +05:30
let label = __('Author');
2018-03-17 18:26:18 +05:30
const $item = instance.dropdown.find('.is-active');
if ($item.length) {
label = $item.text();
}
return label;
},
clicked(options) {
return options.e.preventDefault();
},
id(obj, element) {
return $(element).data('id');
},
});
});
}