Welcome to mirror list, hosted at ThFree Co, Russian Federation.

protected_tag_access_dropdown.js « protected_tags « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: def2f091947c74ef7ac4e419f1d1a9f3be49288c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { __ } from '~/locale';

export default class ProtectedTagAccessDropdown {
  constructor(options) {
    this.options = options;
    this.initDropdown();
  }

  initDropdown() {
    const { onSelect } = this.options;
    this.options.$dropdown.glDropdown({
      data: this.options.data,
      selectable: true,
      inputId: this.options.$dropdown.data('inputId'),
      fieldName: this.options.$dropdown.data('fieldName'),
      toggleLabel(item, $el) {
        if ($el.is('.is-active')) {
          return item.text;
        }
        return __('Select');
      },
      clicked(options) {
        options.e.preventDefault();
        onSelect();
      },
    });
  }
}