summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/issue_status_select.js
blob: 71c0f894389a08827e25c636f847a58416b40f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export default function issueStatusSelect() {
  $('.js-issue-status').each((i, el) => {
    const fieldName = $(el).data('fieldName');
    return $(el).glDropdown({
      selectable: true,
      fieldName,
      toggleLabel(selected, element, instance) {
        let label = 'Author';
        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');
      },
    });
  });
}