o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1373285458.410591: @value" {I" class:EFI"ProcessedAsset;FI"logical_path;F"1iugu-ux/components/usecode/iugu-ui-button.jsI" pathname;F"~/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-button.js.coffeeI"content_type;FI"application/javascript;FI" mtime;FI"2013-07-05T18:24:48-03:00;FI" length;FipI" digest;F"%7c4832b2fc284acb073e25de68384078I" source;FI"p(function() { IuguUI.Button = (function() { Button.prototype.defaults = { none: false, hideInput: true }; Button.prototype.el = void 0; Button.load = function(context) { var elements, selector; selector = "[data-type='iux.form.button']"; if (context) { elements = context.find(selector); } else { elements = $(selector); } if (elements.length === 0) { return; } return elements.each(function() { if ($(this).data("iux.initialized") === true) { return; } new IuguUI.Button({ el: this, context: context }); return $(this).data("iux.initialized", true); }); }; function Button(options) { this.initialize(options); } Button.prototype.initialize = function(options) { var input_selector; _.bindAll(this); this.options = _.extend({}, this.defaults, options); if (!this.options.el) { return null; } this.el = $(this.options.el); if (this.el.data("mode") === "toggle") { this.toggle_button = true; } if (this.options.onClick) { this.onClick = this.options.onClick; } if (this.el.data("input")) { input_selector = "#" + this.el.data("input"); } if (this.options.context && input_selector) { this.input_element = $(this.options.context.find(input_selector)); if (this.input_element.size() === 0) { this.input_element = this.options.context; } this.input_element = $(this.input_element[0]); } else if (input_selector) { this.input_element = $(input_selector); } if (this.getInput() && this.el.data("value") === this.getInput().val()) { if (!this.el.hasClass("selected")) { this.el.addClass("selected"); } } debug(this.getInput()); if (this.getInput() && this.getInput().is(":checkbox") && this.getInput().is(":checked")) { this.el.addClass("selected"); } if (this.getInput() && this.getInput().is(":radio") && this.getInput().is(":checked")) { this.el.addClass("selected"); } this.el.bind("click", this.click); if (this.options.hideInput && this.input_element) { return this.input_element.hide(); } }; Button.prototype.getInput = function() { if (this.input_element) { return $(this.input_element); } return false; }; Button.prototype.linkedElements = function() { return $('[data-group="' + this.el.data("group") + '"]'); }; Button.prototype.hasLinkedElements = function() { var elms; elms = this.linkedElements(); if (!(elms && elms.size() > 1)) { return false; } return true; }; Button.prototype.configureInputElementValue = function(value) { if (!this.getInput()) { return; } if (this.getInput().is(":checkbox")) { this.getInput().attr("checked", this.el.hasClass("selected")); } else if (this.getInput().is(":radio")) { this.getInput().attr("checked", this.el.hasClass("selected")); } else { if (this.getInput()) { this.getInput().val(value); } } if (this.getInput()) { return this.getInput().trigger("change"); } }; Button.prototype.toggleable = function() { if (!this.toggle_button) { return false; } if (this.hasLinkedElements()) { return false; } return true; }; Button.prototype.click = function() { var value; if (this.el.data("value")) { value = this.el.data("value"); } if (this.toggleable()) { this.el.toggleClass("selected"); } if (this.toggleable() && this.el.hasClass("selected") === false) { value = null; } if (this.hasLinkedElements()) { this.linkedElements().removeClass("selected"); this.el.addClass("selected"); } if (value !== null) { if (this.onClick) { this.onClick(value); } return this.configureInputElementValue(value); } else { return this.configureInputElementValue(value); } }; return Button; })(); this.IuguUI.Button = IuguUI.Button; $(function() { return IuguUI.Button.load(); }); }).call(this); ;TI"dependency_digest;F"%747ccee544d8c2aa93707f21ac98bea0I"required_paths;F["~/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-button.js.coffeeI"dependency_paths;F[{I" path;F"~/Users/patricknegri/Desenvolvimento/iugu-ux/vendor/assets/javascripts/iugu-ux/components/usecode/iugu-ui-button.js.coffeeI" mtime;FI"2013-07-05T18:24:48-03:00;FI" digest;F"%72c3fb33e463b0157131fab76c32c6d3I" _version;F"%6776f581a4329e299531e1d52aa59832