{:uriI"file:///Users/mak/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activeadmin-1.0.0/app/assets/javascripts/active_admin/lib/checkbox-toggler.js.coffee?type=application/javascript&pipeline=self&id=60e551f8e448f3578e7ad55bb06927258eef7f9be2a6b074cbb9a85f030472b9:ET:load_pathI"g/Users/mak/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activeadmin-1.0.0/app/assets/javascripts;T:
filenameI"�/Users/mak/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activeadmin-1.0.0/app/assets/javascripts/active_admin/lib/checkbox-toggler.js.coffee;T:	nameI"&active_admin/lib/checkbox-toggler;T:logical_pathI".active_admin/lib/checkbox-toggler.self.js;T:content_typeI"application/javascript;T:sourceI"�	(function() {
  ActiveAdmin.CheckboxToggler = (function() {
    function CheckboxToggler(options, container) {
      var defaults;
      this.options = options;
      this.container = container;
      defaults = {};
      this.options = $.extend(defaults, this.options);
      this._init();
      this._bind();
    }

    CheckboxToggler.prototype._init = function() {
      if (!this.container) {
        throw new Error('Container element not found');
      } else {
        this.$container = $(this.container);
      }
      if (!this.$container.find('.toggle_all').length) {
        throw new Error('"toggle all" checkbox not found');
      } else {
        this.toggle_all_checkbox = this.$container.find('.toggle_all');
      }
      return this.checkboxes = this.$container.find(':checkbox').not(this.toggle_all_checkbox);
    };

    CheckboxToggler.prototype._bind = function() {
      this.checkboxes.change((function(_this) {
        return function(e) {
          return _this._didChangeCheckbox(e.target);
        };
      })(this));
      return this.toggle_all_checkbox.change((function(_this) {
        return function() {
          return _this._didChangeToggleAllCheckbox();
        };
      })(this));
    };

    CheckboxToggler.prototype._didChangeCheckbox = function(checkbox) {
      switch (this.checkboxes.filter(':checked').length) {
        case this.checkboxes.length - 1:
          return this.toggle_all_checkbox.prop({
            checked: null
          });
        case this.checkboxes.length:
          return this.toggle_all_checkbox.prop({
            checked: true
          });
      }
    };

    CheckboxToggler.prototype._didChangeToggleAllCheckbox = function() {
      var setting;
      setting = this.toggle_all_checkbox.prop('checked') ? true : null;
      return this.checkboxes.each((function(_this) {
        return function(index, el) {
          $(el).prop({
            checked: setting
          });
          return _this._didChangeCheckbox(el);
        };
      })(this));
    };

    CheckboxToggler.prototype.option = function(key, value) {
      if ($.isPlainObject(key)) {
        return this.options = $.extend(true, this.options, key);
      } else if (key != null) {
        return this.options[key];
      } else {
        return this.options[key] = value;
      }
    };

    return CheckboxToggler;

  })();

  $.widget.bridge('checkboxToggler', ActiveAdmin.CheckboxToggler);

}).call(this);
;T:
metadata{:dependencieso:Set:
@hash}
I"environment-version;TTI"environment-paths;TTI"rails-env;TTI"jprocessors:type=application/javascript&file_type=application/javascript&engines=.coffee&pipeline=self;TTI"�file-digest:///Users/mak/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activeadmin-1.0.0/app/assets/javascripts/active_admin/lib/checkbox-toggler.js.coffee;TTF:
requiredo;;}�F:stubbedo;;}�F:
linkso;;}�F:charsetI"
utf-8;F:digest"%�ohm��X�7���׫�K�*OB�D�'e��W:lengthi�	:dependencies_digest"%�b.��n@ȵe�y4�;����&�����:idI"E60e551f8e448f3578e7ad55bb06927258eef7f9be2a6b074cbb9a85f030472b9;F:
mtimel+�F�Y