{I" class:ETI"BundledAsset;FI"logical_path;TI"%loldesign_publisher/activable.js;FI" pathname;TI"|/Users/eduardodeoliveirazaghi/Projects/loldesign/loldesign_publisher/app/assets/javascripts/loldesign_publisher/activable.js;FI"content_type;TI"application/javascript;TI" mtime;Tl+½#ęTI" length;TiEI" digest;TI"%26295560f5b7d6839dba9f6efdec6122;FI" source;TI"EjQuery(document).ready(function($) { new activableOption(); }); var activableOption = function(){ var _this = this; this.$links = $('.activable'); this.startup = function(){ if(!this.$links[0]){ return false; } this.$links.on('change', function(event) { event.preventDefault(); if($(this).is(':checked')){ _this.active($(this)); }else{ _this.inactive($(this)); } }); }, this.active = function($link){ $.ajax({ url: '/loldesign_publisher/activables/'+$link.data('resource')+'/'+$link.data('id')+'.json', type: 'POST', dataType: 'json' }) .done(function() { $link.val(true); }) .fail(function() { console.log("error"); }); }, this.inactive = function($link){ $.ajax({ url: '/loldesign_publisher/activables/'+$link.data('resource')+'/'+$link.data('id')+'.json', type: 'DELETE', dataType: 'json' }) .done(function() { $link.val(false); }) .fail(function() { console.log("error"); }); }, this.startup(); } ; ;TI"required_assets_digest;TI"%5b49961e628f3f919a491ed604e4a302;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F