Sha256: 7aac087329e3469dbdf41dd174a9f3343a66ae877b4511c42e13515f507bfc7a

Contents?: true

Size: 896 Bytes

Versions: 7

Compression:

Stored size: 896 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).attr("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

7 entries across 7 versions & 1 rubygems

Version Path
on_the_spot-1.0.3 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.0.2 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.0.1 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-1.0.0 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-0.0.18 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-0.0.17 app/assets/javascripts/jquery.jeditable.checkbox.js
on_the_spot-0.0.16 app/assets/javascripts/jquery.jeditable.checkbox.js