Colors for in_place_editor

Does anyone know how to change the highlight and fade-to color of the AJAX in_place_editor and in_place_editor_field? Amazingly enough, the Rails code seems to assume that we always want yellow highlights and fade-to-white.

  / Peter

Unfortunately, you are out of lack if you are looking for a clean way to do it. The in_place_editor helper doesn't support all the options of Ajax.InPlaceEditor[1]

You could do one of two things.

1) You could monkeypatch lib/actionview/java_script_macros_helper.rb#in_place_editor to support more options. Stick this snippet of code[2] in your application.rb, Then you can call in_place_editor like this:

<%= in_place_editor_field :post, 'title', {}, {:highlight_color => '#FF0000', :highlight_end_color => '#BB00FF' }

2) You could change your local copy of script.aculo.us in 'public/javascrips/control.js#Ajax.InPlaceEditor.defaultHighlightColor' and all related default values in where InPlaceEditor is defined.

Keeping in mind that InPlaceEditor is going to become a plugin in Rails 2.0, I would think it will eventually see some improvements on that area.

-christos

[1] http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
[2] http://pastie.caboo.se/38229

Thanks for the quick reply. (1) is obviously the better way, so I'll stick to that. It is somewhat surprising, though, that Rails assumes every web application has a white background... How 2.0. :wink:

  / Peter

6 feb 2007 kl. 12.12 skrev Christos Zisopoulos: