Sha256: f67106e8e3a944b0bc1c264698ca1d5dc20a12da50eebb096eab815962cf588f

Contents?: true

Size: 895 Bytes

Versions: 6

Compression:

Stored size: 895 Bytes

Contents

/**********************************************************************
 *	Custom input types for the jquery.jeditable plugin
 * By Richard Davies <Richard__at__richarddavies.us>, 2009
 * By Peter Savichev (proton) <psavichev@gmail.com>, 2011
 *********************************************************************/

// Create a custom input type for checkboxes
$.editable.addInputType("checkbox", {
	element : function(settings, original) {
		var input = $('<input type="checkbox">');
		$(this).append(input);

		$(input).change(function() {
			var value = $(input).is(":checked") ? 1 : 0;
			$(input).val(value);
		});
		return(input);
	},
	content : function(string, settings, original) {
		var checked = (string == "true") ? 1 : 0;
		var input = $(':input:first', this);
		if(checked) $(input).attr("checked", "checked");
		else $(input).removeAttr("checked");
		$(input).val(checked);
	}
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
on_the_spot-1.1.3 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.1.2 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.1.0 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.0.6 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.0.5 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.0.4 app/assets/javascripts/jquery.jeditable.checkbox.js