debian-mirror-gitlab/app/assets/javascripts/subscription_select.js

34 lines
1 KiB
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
/* 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 */
2017-09-10 17:25:29 +05:30
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");
}
2016-09-13 17:45:13 +05:30
});
2017-09-10 17:25:29 +05:30
});
}
}
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
window.SubscriptionSelect = SubscriptionSelect;