summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/subscription_select.js
blob: 0cd591c73208673730951ea4fccbef19385325fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* 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 */
(function() {
  this.SubscriptionSelect = (function() {
    function SubscriptionSelect() {
      $('.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 SubscriptionSelect;
  })();
}).call(window);