2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
2020-11-24 15:15:51 +05:30
|
|
|
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { __ } from './locale';
|
2018-05-09 12:01:36 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
export default function subscriptionSelect() {
|
|
|
|
$('.js-subscription-event').each((i, element) => {
|
2018-03-27 19:54:05 +05:30
|
|
|
const fieldName = $(element).data('fieldName');
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
return initDeprecatedJQueryDropdown($(element), {
|
2018-03-17 18:26:18 +05:30
|
|
|
selectable: true,
|
|
|
|
fieldName,
|
|
|
|
toggleLabel(selected, el, instance) {
|
2019-09-04 21:01:54 +05:30
|
|
|
let label = __('Subscription');
|
2018-03-17 18:26:18 +05:30
|
|
|
const $item = instance.dropdown.find('.is-active');
|
|
|
|
if ($item.length) {
|
|
|
|
label = $item.text();
|
2017-09-10 17:25:29 +05:30
|
|
|
}
|
2018-03-17 18:26:18 +05:30
|
|
|
return label;
|
|
|
|
},
|
|
|
|
clicked(options) {
|
|
|
|
return options.e.preventDefault();
|
|
|
|
},
|
|
|
|
id(obj, el) {
|
|
|
|
return $(el).data('id');
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2017-09-10 17:25:29 +05:30
|
|
|
}
|