Integrating FCK Editor Plugin in Active Scaffold is very easy
Assuming FCK Editor Plugin is installed in your application.
In controller we need to write the following code to make it work:
Considering the category we have this as usual
active_scaffold :category do |config|
config.label = “Category” # Display page name
config.columns = [:name, :rank, :description] # all fields are taken
list.columns.exclude :description #exclude description column in list
end
In Category_Helper.rb we need to add the following code
#description field is shown in FCK editor format
def description_form_column(record, input_name)
fckeditor_textarea( :record, :description, :toolbarSet => ‘Simple’, :name=> input_name, :width => “800px”, :height => “200px” )
end
#description text is displayed in rich format
def description_column(record)
sanitize(record.description)
end
and we need to copy the “_create_form.rhtml” & “_update_form.rhtml” from ..\vendor\plugins\active_scaffold\frontends\default\views to Views/Category and edit _create_form.rhtml by adding following code to it
Instead of <%= submit_tag as_(‘Create’), :class => “submit” %>
we add following code
<input type=“submit” value=“Create” class=“submit”
onClick=“var oEditor = FCKeditorAPI.GetInstance(‘record_<%=@record.id%>_<%=’description’%>_editor’);
document.getElementById(‘record_<%=@record.id%>_<%=’description’%>_editor’).value = oEditor.GetXHTML();” />
and the same in _update_form.rhtml just replacing the value “Create” to “Update”
and your code will be working fine.
Hi
I tried using fckeditor with active_scaffold as you stated above. but i get the following error on adding both active_scaffold and fckeditor plugins on all the pages using active_scaffold
undefined method `configure’ for #
can anyone help me with it?
http://www.musterdenker.de/2009/03/rails-22-active_scaffold-and-fckeditor/
hi manjiri….
I have integrated so many times fckeditor with activescaffold it worked for me… can u send me the code so that I can check wat d problem is… my personal gmailID is ganeshmohan99@gmail.com you can contact me to this mail-ID.
regards
Ganesh
Thanks! Just followed the instructions, and they worked perfectly.
[...] of the FCKEditor Plugin. To integrate the FCKEditor with Active_Scaffold i was following is Tutorial. But it seems that this does not run with Rails 2.2. We´ve got the following error: ?View Code [...]
Hi…
I have integrated FCK editor with active_scaffold in Rails 2.1.0 and it worked for me. Sorry I have no idea about Rails 2.2 since didnot use it.
Шрифт трудно читается у вас на блоге
Полностью согласна!
Your instructions worked perfectly with the following:
Rails 2.3.2
Ruby 1.8.6
FCKEditor 2.6.3 (Easy FCKEditor Rails Plugin)
Gud…Reall nice…worked perfectly for me..
Rails -v 2.3.5
Worked Perfectly..thanks..
FCK Editor
ruby script/plugin install git://github.com/gramos/easy-fckeditor.git
Ruby: 1.8.6
Rails:2.3.5
[...] これで作業は終わり。なおこれは、http://ganeshmohan.wordpress.com/2008/11/12/fck-editor-plugin-in-activescaffold/を参考にCKEditor用に多少変更を加えたものである。 Easy AdSense by Unreal [...]