gitlab-org--gitlab-foss/app/assets/javascripts/subscription_select.js
Brandon Labuschagne 29a47bfc27 I18N JS files starting with s
This is one of many MRs opened in order to improve the overall
internationalisation of the GitLab codebase.

This commit only targets Vanilla JS files.

i18n documentation
https://docs.gitlab.com/ee/development/i18n/externalization.html
2019-05-21 11:27:11 +02:00

27 lines
685 B
JavaScript

import $ from 'jquery';
import { __ } from './locale';
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');
},
});
});
}