{I" class:ETI"BundledAsset;FI"logical_path;TI")active_admin/lib/checkbox-toggler.js;FI" pathname;TI"”/opt/rubies/2.0.0-p481/lib/ruby/gems/2.0.0/bundler/gems/active_admin-c5e3ab82b9b5/app/assets/javascripts/active_admin/lib/checkbox-toggler.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+€Ü'UI" length;TilI" digest;TI"%71efe70af420ba0aef07b4e19fc2fc06;FI" source;TI"l(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)); }; return CheckboxToggler; })(); $.widget.bridge('checkboxToggler', ActiveAdmin.CheckboxToggler); }).call(this); ;TI"required_assets_digest;TI"%1c49f529d231db6640b96530503437a3;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F