rendered paste bodyAjax.InPlaceCheckboxEditor = Class.create();
Object.extend(Ajax.InPlaceCheckboxEditor.prototype, Ajax.InPlaceEditor.prototype);
Object.extend(Ajax.InPlaceCheckboxEditor.prototype, {
createEditField: function() {
if (!this.cached_collectionTag) {
var collection = this.options.collection || [];
var collectionTag = document.createElement("div");
var checkboxTag;
collection.each(function(e,i) {
checkboxTag = document.createElement("input");
checkboxTag.type = "checkbox";
checkboxTag.value = (e instanceof Array) ? e[0] : e;
if((typeof this.options.value == 'undefined') &&
((e instanceof Array) ? this.element.innerHTML == e[1] : e == checkboxTag.value)) checkboxTag.checked = "checked";
if(this.options.value==checkboxTag.value) checkboxTag.checked = "checked";
checkboxTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
collectionTag.appendChild(checkboxTag);
}.bind(this));
this.cached_collectionTag = collectionTag;
}
this.editField = this.cached_collectionTag;
if(this.options.loadTextURL) this.loadExternalText();
this.form.appendChild(this.editField);
this.options.callback = function(form, value) {
return "value=" + encodeURIComponent(value);
}
}
});