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

25 lines
626 B
JavaScript
Raw Normal View History

2017-11-20 15:28:29 -05:00
export default function subscriptionSelect() {
$('.js-subscription-event').each((i, element) => {
const fieldName = $(element).data('field-name');
2017-11-20 15:28:29 -05:00
return $(element).glDropdown({
selectable: true,
fieldName,
toggleLabel(selected, el, instance) {
let label = 'Subscription';
const $item = instance.dropdown.find('.is-active');
if ($item.length) {
label = $item.text();
}
2017-11-20 15:28:29 -05:00
return label;
},
clicked(options) {
return options.e.preventDefault();
},
id(obj, el) {
return $(el).data('id');
},
});
2017-11-20 15:28:29 -05:00
});
}