o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1337178513.06269: @value"’{I" class:EFI"ProcessedAsset;FI"logical_path;F">ems/active_admin/components/jquery.aa.checkbox-toggler.jsI" pathname;F"Œ/private/var/www/html/development/projects/rails/ems/app/assets/javascripts/ems/active_admin/components/jquery.aa.checkbox-toggler.js.coffeeI"content_type;FI"application/javascript;FI" mtime;FI"2012-05-16T15:14:22+01:00;FI" length;Fi­ I" digest;F"%1d2e61e0da1e81d82380bc0382b1ac74I" source;FI"­ (function() { window.AA.CheckboxToggler = AA.CheckboxToggler = (function() { function CheckboxToggler(options, container) { var defaults; this.options = options; this.container = container; defaults = {}; this.options = $.extend({}, defaults, 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() { var _this = this; this.checkboxes.bind("change", function(e) { return _this._didChangeCheckbox(e.target); }); return this.toggle_all_checkbox.bind("change", function(e) { return _this._didChangeToggleAllCheckbox(); }); }; CheckboxToggler.prototype._didChangeCheckbox = function(checkbox) { if (this.checkboxes.filter(":checked").length === this.checkboxes.length - 1) { return this._uncheckToggleAllCheckbox(); } else if (this.checkboxes.filter(":checked").length === this.checkboxes.length) { return this._checkToggleAllCheckbox(); } }; CheckboxToggler.prototype._didChangeToggleAllCheckbox = function() { if (this.toggle_all_checkbox.attr("checked") === "checked") { return this._checkAllCheckboxes(); } else { return this._uncheckAllCheckboxes(); } }; CheckboxToggler.prototype._uncheckToggleAllCheckbox = function() { return this.toggle_all_checkbox.removeAttr("checked"); }; CheckboxToggler.prototype._checkToggleAllCheckbox = function() { return this.toggle_all_checkbox.attr("checked", "checked"); }; CheckboxToggler.prototype._uncheckAllCheckboxes = function() { var _this = this; return this.checkboxes.each(function(index, el) { $(el).removeAttr("checked"); return _this._didChangeCheckbox(el); }); }; CheckboxToggler.prototype._checkAllCheckboxes = function() { var _this = this; return this.checkboxes.each(function(index, el) { $(el).attr("checked", "checked"); return _this._didChangeCheckbox(el); }); }; return CheckboxToggler; })(); (function($) { return $.widget.bridge('checkboxToggler', AA.CheckboxToggler); })(jQuery); }).call(this); ;TI"dependency_digest;F"%488b3b6125a35cc3fd59f9616ccd6c50I"required_paths;F["Œ/private/var/www/html/development/projects/rails/ems/app/assets/javascripts/ems/active_admin/components/jquery.aa.checkbox-toggler.js.coffeeI"dependency_paths;F[{I" path;F"Œ/private/var/www/html/development/projects/rails/ems/app/assets/javascripts/ems/active_admin/components/jquery.aa.checkbox-toggler.js.coffeeI" mtime;FI"2012-05-16T15:14:22+01:00;FI" digest;F"%9ca9dccb9383bf631dac9da71d90c2abI" _version;F"%9f3b95dd7ea3030dc35985c0a8020862