2 * InPlaceEditor extension that adds a 'click to edit' text when the field is
5 Ajax.InPlaceEditor.prototype.__initialize = Ajax.InPlaceEditor.prototype.initialize;
6 Ajax.InPlaceEditor.prototype.__getText = Ajax.InPlaceEditor.prototype.getText;
7 Ajax.InPlaceEditor.prototype.__onComplete = Ajax.InPlaceEditor.prototype.onComplete;
8 Ajax.InPlaceEditor.prototype = Object.extend(Ajax.InPlaceEditor.prototype, {
10 initialize: function(element, url, options){
11 this.__initialize(element,url,options)
12 this.setOptions(options);
16 setOptions: function(options){
17 this.options = Object.extend(Object.extend(this.options,{
18 emptyText: 'click to edit...',
19 emptyClassName: 'inplaceeditor-empty'
23 _checkEmpty: function(){
24 if( this.element.innerHTML.length == 0 ){
25 this.element.appendChild(
26 Builder.node('span',{className:this.options.emptyClassName},this.options.emptyText));
31 document.getElementsByClassName(this.options.emptyClassName,this.element).each(function(child){
32 this.element.removeChild(child);
34 return this.__getText();
37 onComplete: function(transport){
39 this.__onComplete(transport);