sandbox/tmp/cache/assets/DFC/5B0/sprockets%2Fcece55fa8f17c917fcc78cf6113a01bb in iugu-ux-1.0.2 vs sandbox/tmp/cache/assets/DFC/5B0/sprockets%2Fcece55fa8f17c917fcc78cf6113a01bb in iugu-ux-1.0.3

- old
+ new

@@ -1,19 +1,18 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1373285458.410591: @value" {I" +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1374498083.765145: @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() { +mtime;FI"2013-07-08T15:43:17-03:00;FI" length;FiòI" digest;F"%ded205fcc0c4a199b81636b894c1f0d3I" source;FI"ò(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); @@ -37,11 +36,10 @@ 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; } @@ -62,22 +60,24 @@ } 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.getInput() && this.el.data("value") && this.el.data("value").toString() === this.getInput().val().toString()) { 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"); } + if (this.getInput() && this.getInput().is(":radio") || this.getInput().is(":checkbox")) { + this.getInput().bind("change", this.inputChangedCallback); + } this.el.bind("click", this.click); if (this.options.hideInput && this.input_element) { return this.input_element.hide(); } }; @@ -93,18 +93,29 @@ 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.inputChangedCallback = function() { + if (this.hasLinkedElements()) { + this.linkedElements().removeClass("selected"); + } + 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")) { + return this.el.addClass("selected"); + } + }; + Button.prototype.configureInputElementValue = function(value) { if (!this.getInput()) { return; } if (this.getInput().is(":checkbox")) { @@ -131,11 +142,10 @@ 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"); @@ -166,7 +176,7 @@ $(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 +;TI"dependency_digest;F"%c7c9047d6dbb107f624b67fad03df68eI"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-08T15:43:17-03:00;FI" digest;F"%26f4b76da9b65b134ff67ee6fd1e2749I" _version;F"%6776f581a4329e299531e1d52aa59832 \ No newline at end of file