summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/subscription_select.js
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-11-20 20:28:29 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-11-20 20:28:29 +0000
commit030de8b32889eae832d512f30079403e0da7f699 (patch)
treed3c03048ae5995dfb85ccfbb33bde4e662500350 /app/assets/javascripts/subscription_select.js
parent2b594daf9aa10f9a6469addb52f0df283f5347fb (diff)
downloadgitlab-ce-030de8b32889eae832d512f30079403e0da7f699.tar.gz
Export code as ES6 modules38869-milestone
Diffstat (limited to 'app/assets/javascripts/subscription_select.js')
-rw-r--r--app/assets/javascripts/subscription_select.js49
1 files changed, 20 insertions, 29 deletions
diff --git a/app/assets/javascripts/subscription_select.js b/app/assets/javascripts/subscription_select.js
index 37e39ce5477..1ab4c2229ca 100644
--- a/app/assets/javascripts/subscription_select.js
+++ b/app/assets/javascripts/subscription_select.js
@@ -1,33 +1,24 @@
-/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, quotes, object-shorthand, no-unused-vars, no-shadow, one-var, one-var-declaration-per-line, comma-dangle, max-len */
+export default function subscriptionSelect() {
+ $('.js-subscription-event').each((i, element) => {
+ const fieldName = $(element).data('field-name');
-class SubscriptionSelect {
- constructor() {
- $('.js-subscription-event').each(function(i, el) {
- var fieldName;
- fieldName = $(el).data("field-name");
- return $(el).glDropdown({
- selectable: true,
- fieldName: fieldName,
- toggleLabel: (function(_this) {
- return function(selected, el, instance) {
- var $item, label;
- label = 'Subscription';
- $item = instance.dropdown.find('.is-active');
- if ($item.length) {
- label = $item.text();
- }
- return label;
- };
- })(this),
- clicked: function(options) {
- return options.e.preventDefault();
- },
- id: function(obj, el) {
- return $(el).data("id");
+ 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');
+ },
});
- }
+ });
}
-
-window.SubscriptionSelect = SubscriptionSelect;