2018-03-09 15:18:59 -05:00
|
|
|
import $ from 'jquery';
|
2019-05-07 02:40:58 -04:00
|
|
|
import { __ } from './locale';
|
2018-03-09 15:18:59 -05:00
|
|
|
|
2017-11-20 15:28:29 -05:00
|
|
|
export default function subscriptionSelect() {
|
|
|
|
$('.js-subscription-event').each((i, element) => {
|
2018-02-20 17:20:48 -05:00
|
|
|
const fieldName = $(element).data('fieldName');
|
2017-07-05 13:20:41 -04:00
|
|
|
|
2017-11-20 15:28:29 -05:00
|
|
|
return $(element).glDropdown({
|
|
|
|
selectable: true,
|
|
|
|
fieldName,
|
|
|
|
toggleLabel(selected, el, instance) {
|
2019-05-07 02:40:58 -04:00
|
|
|
let label = __('Subscription');
|
2017-11-20 15:28:29 -05:00
|
|
|
const $item = instance.dropdown.find('.is-active');
|
|
|
|
if ($item.length) {
|
|
|
|
label = $item.text();
|
2017-07-05 13:20:41 -04:00
|
|
|
}
|
2017-11-20 15:28:29 -05:00
|
|
|
return label;
|
|
|
|
},
|
|
|
|
clicked(options) {
|
|
|
|
return options.e.preventDefault();
|
|
|
|
},
|
|
|
|
id(obj, el) {
|
|
|
|
return $(el).data('id');
|
|
|
|
},
|
2017-07-05 13:20:41 -04:00
|
|
|
});
|
2017-11-20 15:28:29 -05:00
|
|
|
});
|
2017-06-30 17:27:31 -04:00
|
|
|
}
|