Thanks
Láďa
Create an _create_form.rhtml, copying the appropriate template from
ActiveScaffold, and make the top part look like this:
<% url_options = params_for(:action => :create) -%>
<% if request.xhr? -%>
<%= form_remote_tag :url => url_options,
:before => fckeditor_before_js('record', 'body'),
:after => "$('#{loading_indicator_id(:action
=> :create, :id => params[:id])}').style.visibility = 'visible';
Form.disable('#{element_form_id(:action => :create)}');",
:complete => "$('#{loading_indicator_id(:action
=> :create, :id => params[:id])}').style.visibility = 'hidden';
Form.enable('#{element_form_id(:action => :create)}');",
:failure => "ActiveScaffold.report_500_response
('#{active_scaffold_id}')",
:html => {
:href => url_for(url_options),
:id => element_form_id(:action => :create),
:class => 'create'
} %>
<% else -%>
<%= form_tag url_options,
:id => element_form_id(:action => :create),
:multipart => active_scaffold_config.create.multipart?,
:class => 'create' %>
<% end -%>
....
Repeat for _update_form.rhtml:
<% url_options = params_for(:action => :update) -%>
<% if request.xhr? -%>
<%= form_remote_tag :url => url_options,
:before => fckeditor_before_js('record', 'body'),
:after => "$('#{loading_indicator_id(:action
=> :update, :id => params[:id])}').style.visibility = 'visible';
Form.disable('#{element_form_id(:action => :update)}');",
:complete => "$('#{loading_indicator_id(:action
=> :update, :id => params[:id])}').style.visibility = 'hidden';
Form.enable('#{element_form_id(:action => :update)}');",
:failure => "ActiveScaffold.report_500_response
('#{active_scaffold_id}')",
:html => {
:href => url_for(url_options),
:id => element_form_id(:action => :update),
:class => 'update',
:method => :put
} %>
<% else -%>
<%= form_tag url_options,
:id => element_form_id(:action => :update),
:multipart => active_scaffold_config.update.multipart?,
:class => 'create' %>
<% end -%>
...
And (this assumes your column is named "body" -- change "body" to
whatever the field you want to edit is) make a file named
_body_form_column.rhtml that looks something like this:
<dl>
<dt>
<label for="record_<%= @record.id -%>_body_editor"><%=h
column.label -%></label>
</dt>
<dd>
<% if request.xhr? -%>
<%= fckeditor_textarea("record", "body", :id => "record
[body]", :toolbarSet => 'Simple', :width => '100%', :height =>
'400px', :ajax => true) -%>
<% else -%>
<textarea id="record_body" name="record[body]"><%=h
@record.body -%></textarea>
<% end -%>
</dd>
</dl>
Láďa
> > to know whether is it worth to spend time on it :-)FCKeditorshows ok
> > for me, but when I click Update/Create, no text is passed as param. I
> > saw workingFCKeditorwith AjaxScaffold on Scott's blog, but it was
Thanks,
Bill