gitlab-org--gitlab-foss/app/assets/javascripts/subscription_select.js
2018-03-09 15:18:09 -06:00

26 lines
650 B
JavaScript

import $ from 'jquery';
export default function subscriptionSelect() {
$('.js-subscription-event').each((i, element) => {
const fieldName = $(element).data('fieldName');
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();
}
return label;
},
clicked(options) {
return options.e.preventDefault();
},
id(obj, el) {
return $(el).data('id');
},
});
});
}