{:uriI"file:///Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts/loldesign_publisher/libs/ui/gumby.radiobtn.js?type=application/javascript&pipeline=self&id=86d2b17f49afa54f40a2801fd979300aa7180f5c4a639312a5335653b004c67b:ET:load_pathI"`/Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts;T: filenameI"/Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts/loldesign_publisher/libs/ui/gumby.radiobtn.js;T: nameI"/loldesign_publisher/libs/ui/gumby.radiobtn;T:logical_pathI"7loldesign_publisher/libs/ui/gumby.radiobtn.self.js;T:content_typeI"application/javascript;T: sourceI"/** * Gumby RadioBtn */ !function($) { 'use strict'; function RadioBtn($el) { Gumby.debug('Initializing Radio Button', $el); this.$el = $el; this.$input = this.$el.find('input[type=radio]'); var scope = this; // listen for click event and custom gumby check event this.$el.on(Gumby.click, function(e) { // prevent radio button checking, we'll do that manually e.preventDefault(); // do nothing if radio is disabled if (scope.$input.is('[disabled]')) { return; } // check radio button scope.update(); }).on('gumby.check', function() { Gumby.debug('Check event triggered', scope.$el); scope.update(); }); // update any prechecked on load if(this.$input.prop('checked') || this.$el.hasClass('checked')) { scope.update(true); } } // check radio button, uncheck all others in name group RadioBtn.prototype.update = function() { // already checked so no need to update if(this.$el.hasClass('checked') && this.$input.prop('checked') && this.$el.find('i.icon-dot').length) { return; } Gumby.debug('Updating Radio Button group', this.$el); var $span = this.$el.find('span'), // the group of radio buttons group = 'input[name="'+this.$input.attr('name')+'"]'; // uncheck radio buttons in same group - uncheck input, remove checked class, remove $('.radio').has(group).removeClass('checked') .find('input').prop('checked', false).end() .find('i').remove(); // check this radio button - check input, add checked class, append this.$input.prop('checked', true); $span.append(''); Gumby.debug('Triggering onCheck event', this.$el); this.$el.addClass('checked').trigger('gumby.onCheck'); }; // add initialisation Gumby.addInitalisation('radiobtn', function() { $('.radio').each(function() { var $this = $(this); // this element has already been initialized if($this.data('isRadioBtn')) { return true; } // mark element as initialized $this.data('isRadioBtn', true); new RadioBtn($this); }); }); // register UI module Gumby.UIModule({ module: 'radiobtn', events: ['onCheck', 'check'], init: function() { Gumby.initialize('radiobtn'); } }); }(jQuery); ;T: metadata{ :dependencieso:Set: @hash{ I"environment-version;TTI"environment-paths;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts/loldesign_publisher/libs/ui/gumby.radiobtn.js;TT: requiredo;;{: stubbedo;;{: linkso;;{: charsetI" utf-8;F: digest"%zqi2lg/'s62Sґ6: lengthi:dependencies_digest"%gPLDiS 8Zo\SI :idI"E86d2b17f49afa54f40a2801fd979300aa7180f5c4a639312a5335653b004c67b;F: mtimel+xT