{I" class:ETI"ProcessedAsset;FI"logical_path;TI"2loldesign_publisher/libs/ui/gumby.checkbox.js;FI" pathname;TI"‰/Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts/loldesign_publisher/libs/ui/gumby.checkbox.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+DZûSI" length;Tiü I" digest;TI"%80d497aeacb639cfe01774555cc297e3;FI" source;TI"ü /** * Gumby Checkbox */ !function($) { 'use strict'; function Checkbox($el) { Gumby.debug('Initializing Checkbox', $el); this.$el = $el; this.$input = this.$el.find('input[type=checkbox]'); var scope = this; // listen for click event and custom gumby check/uncheck events this.$el.on(Gumby.click, function(e) { // prevent checkbox checking, we'll do that manually e.preventDefault(); // do nothing if checkbox is disabled if(scope.$input.is('[disabled]')) { return; } // check/uncheck if(scope.$el.hasClass('checked')) { scope.update(false); } else { scope.update(true); } }).on('gumby.check', function() { Gumby.debug('Check event triggered', scope.$el); scope.update(true); }).on('gumby.uncheck', function() { Gumby.debug('Uncheck event triggered', scope.$el); scope.update(false); }); // update any prechecked on load if(this.$input.prop('checked') || this.$el.hasClass('checked')) { scope.update(true); } } // update checkbox, check equals true/false to sepcify check/uncheck Checkbox.prototype.update = function(check) { var $span = this.$el.find('span'); // check checkbox - check input, add checked class, append if(check) { Gumby.debug('Checking Checkbox', this.$el); $span.append(''); this.$input.prop('checked', true); Gumby.debug('Triggering onCheck event', this.$el); Gumby.debug('Triggering onChange event', this.$el); this.$el.addClass('checked').trigger('gumby.onCheck').trigger('gumby.onChange'); // uncheck checkbox - uncheck input, remove checked class, remove } else { Gumby.debug('Unchecking Checkbox', this.$el); this.$input.prop('checked', false); $span.find('i').remove(); Gumby.debug('Triggering onUncheck event', this.$el); Gumby.debug('Triggering onChange event', this.$el); this.$el.removeClass('checked').trigger('gumby.onUncheck').trigger('gumby.onChange'); } }; // add initialisation Gumby.addInitalisation('checkbox', function() { $('.checkbox').each(function() { var $this = $(this); // this element has already been initialized if($this.data('isCheckbox')) { return true; } // mark element as initialized $this.data('isCheckbox', true); new Checkbox($this); }); }); // register UI module Gumby.UIModule({ module: 'checkbox', events: ['onCheck', 'onUncheck', 'onChange', 'check', 'uncheck'], init: function() { Gumby.initialize('checkbox'); } }); }(jQuery); ;TI"dependency_digest;TI"%f520ab1221358812d2cacc3a1dd8854c;FI"required_paths;T[I"‰/Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts/loldesign_publisher/libs/ui/gumby.checkbox.js;FI"dependency_paths;T[{I" path;TI"‰/Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts/loldesign_publisher/libs/ui/gumby.checkbox.js;FI" mtime;TI"2014-08-25T12:46:12-03:00;TI" digest;TI"%7d22d6042bd19ae2c8448da82c9373f3;FI" _version;TI"%01511319732b44ed6445e68132ed559b;F