2017-01-10 18:02:20 -05:00
|
|
|
/* 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-07-05 13:20:41 -04:00
|
|
|
|
2017-06-30 17:27:31 -04:00
|
|
|
class SubscriptionSelect {
|
|
|
|
constructor() {
|
2017-07-05 13:20:41 -04:00
|
|
|
$('.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-07-24 16:45:11 -04:00
|
|
|
});
|
2017-07-05 13:20:41 -04:00
|
|
|
});
|
|
|
|
}
|
2017-06-30 17:27:31 -04:00
|
|
|
}
|
2016-07-24 16:45:11 -04:00
|
|
|
|
2017-06-30 17:27:31 -04:00
|
|
|
window.SubscriptionSelect = SubscriptionSelect;
|