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;
for(var index=0; index<this.options.values.length; ++index) {
if (this.options.values[index] == checkboxTag.value) checkboxTag.checked = "checked";
}
collectionTag.appendChild(checkboxTag);
collectionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
}.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);
}
}
});