I just coded an unobtrusive In Place Editor and wanted to get some 
review and comments for it. Anyone spot anything obvious that I could 
do to streamline this?

Thanks,

Walter

<script type="text/javascript" charset="utf-8">
        var rightClick = function(e){
                Event.stop(e);
                var editListing = new Ajax.InPlaceEditor("listing_body",
                        "ajax_update.php",
                        {rows:20,cols:50,
                        onComplete: function(transport, element) {
                                new Effect.Highlight(element,
                                        {startcolor: 
this.options.highlightcolor});
                                editListing.dispose();
                        },
                        loadTextURL: "get_raw.php?id=<?= $id 
?>&field=description",
                        ajaxOptions: {method: "post"},
                        callback: function(form, value) {
                                return "id=<?= $id 
?>&field=description&myparam=" + 
encodeURIComponent(value)
                        }
                });
                if(editListing) editListing.enterEditMode('click');
        };
        var editThis = function(){
                Event.observe('PageDiv','contextmenu',rightClick);
        };
        Event.observe(window,'load',editThis);
</script>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to