diff options
Diffstat (limited to 'app/assets/javascripts/issuable_bulk_update_sidebar/subscription_select.js')
-rw-r--r-- | app/assets/javascripts/issuable_bulk_update_sidebar/subscription_select.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/assets/javascripts/issuable_bulk_update_sidebar/subscription_select.js b/app/assets/javascripts/issuable_bulk_update_sidebar/subscription_select.js new file mode 100644 index 00000000000..b12ac776b4f --- /dev/null +++ b/app/assets/javascripts/issuable_bulk_update_sidebar/subscription_select.js @@ -0,0 +1,28 @@ +import $ from 'jquery'; +import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown'; +import { __ } from '~/locale'; + +export default function subscriptionSelect() { + $('.js-subscription-event').each((i, element) => { + const fieldName = $(element).data('fieldName'); + + return initDeprecatedJQueryDropdown($(element), { + 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'); + }, + }); + }); +} |