FCKeditor in Active Scaffold

6 views
Skip to first unread message

Láďa

unread,
May 28, 2007, 4:20:04 PM5/28/07
to ActiveScaffold : Ruby on Rails plugin
Hi, does someone get Active Scaffold working with great FCKeditor
plugin? I came to the point, where editor is being shown ok (well, it
was not hard), but no data are sent back. I used
<%= fckeditor_textarea( "record", "perex", :height => '200px', :width
=> '100%', :toolbarSet => 'Basic') %>
or
<%= fckeditor_textarea( "record", "perex", :height => '200px', :width
=> '100%', :toolbarSet => 'Basic', :ajax => true) %>
but still without any result.

Thanks

Láďa

unread,
Jun 2, 2007, 4:42:38 AM6/2/07
to ActiveScaffold : Ruby on Rails plugin
Really noone? Or some other WISIWYG editor like TinyMCE, I just want
to know whether is it worth to spend time on it :-) FCKeditor shows ok
for me, but when I click Update/Create, no text is passed as param. I
saw working FCKeditor with AjaxScaffold on Scott's blog, but it was
really easy there, just adding helpers, no hacks.

Láďa

Frisby Jon

unread,
Jun 2, 2007, 5:30:52 AM6/2/07
to actives...@googlegroups.com
You need to customize the form tag...

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

unread,
Jun 2, 2007, 8:54:54 AM6/2/07
to ActiveScaffold : Ruby on Rails plugin
Thanks a lot, works perfect.

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

Bill Lazar

unread,
Jun 24, 2007, 7:04:01 PM6/24/07
to actives...@googlegroups.com
I tried following this instruction but am getting a "can't dup
Symbol" error for the line <%= javascript_include_tag :fckeditor %>.
Anyone else seen this?

Thanks,
Bill

Reply all
Reply to author
Forward
0 new messages