{:uriI"Õfile:///Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/form/inputs/checkboxer.js?type=application/javascript&pipeline=self&id=44db436853c02e38f9964e204aab29443ed8cfe7526a6b2ea44a28db322d9acd:ET:load_pathI"G/Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts;F: filenameI"e/Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/form/inputs/checkboxer.js;T: nameI"fae/form/inputs/checkboxer;T:logical_pathI"'fae/form/inputs/checkboxer.self.js;T:content_typeI"application/javascript;T: sourceI"u// plugin have a checkbox in the thead of a table that controls that table column's checkboxes. // this should be placed on the containing TH of the master checkbox. var Checkboxer = { options: { class_name: "js-active" }, init: function(options, elm){ //reference for callback var that = this; // unite the default options with the passed-in ones this.options = $.extend({}, this.options, options); // saving element reference this.elm = elm; this.th = elm; // saving table column, table parent this.column = $(elm).index() + 1; this.table = $(elm).closest("table"); // save the group of tbdoy tds this.tds = $(this.table).find("td:nth-child(" + this.column + ")"); // makes it all start working this.td_event(); this.th_event(); }, get_checked: function() { return $(this.tds).find(":checked"); }, td_event: function(){ var that = this; var $checkboxes = $(this.tds).find(":checkbox"); $checkboxes.change(function(){ var $th = $(that.table).find(that.th); var $td = $(that.tds); var $td_checked = that.get_checked(); $(this).siblings("label").toggleClass(that.options.class_name); if($td.length == $td_checked.length) { $th.find(":checkbox").prop("checked", true); $th.find("label").addClass(that.options.class_name); } else { $th.find(":checkbox").removeAttr("checked"); $th.find("label").removeClass(that.options.class_name); } }); }, th_event: function() { var that = this; $(that.th).find("label").click(function(){ var $td = $(that.tds); if ($(this).hasClass(that.options.class_name)) { $(this).removeClass(that.options.class_name); // uncheck all checkboxes $td.find(":checkbox").removeAttr("checked"); // remove the class to the labels for the icons $td.find("label").removeClass(that.options.class_name); } else { $(this).addClass(that.options.class_name); // check all checkboxes\ $td.find(":checkbox").prop("checked", true); // add the class to the labels for the icons $td.find("label").addClass(that.options.class_name); } }); } }; // make it a plugin $.plugin("checkboxer", Checkboxer); ;T: metadata{ :dependencieso:Set: @hash{ I"environment-version;TTI"environment-paths;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"sfile-digest:///Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/form/inputs/checkboxer.js;TT: requiredo;;{: stubbedo;;{: linkso;;{: charsetI" utf-8;F: digest"%áÃÓ\Vþš²®üM\¬ÞIu@_ÌM7Ñjôm ÍÝÜp: lengthiu:integrityI"Xni:///sha-256;4cPTXBdW_pqyrvxNXKzeSXVAX8wXTTfRavRtC83d3HA?ct=application/javascript;T:dependencies_digest"%/"¸'±mƒu'mõ}¯4Ý^0c3á;¾KU–Y8Þ:idI"E44db436853c02e38f9964e204aab29443ed8cfe7526a6b2ea44a28db322d9acd;F: mtimel+QóU