I have been asked a few times for the code for the FCKeditor demo. So I thought I would put it up here for anyone to download, and by here I mean here.
The tar includes the fckeditor plugin, the ajax scaffold plugin and the bits to get them working together. You will need to create a db and update the config files though.










14 Comments
Just installed and tried the plugin – works brilliantly – thanks very much!
Hi TP, glad you find it useful. Cheers
Scott.
I’m getting a 403 error when I try to upload an image. I narrowed it down into the check_file method, when it checks whether the file is a Tempfile it comes back as StringIO instead. Any ideas as to why or how to fix it?
Thanks!
In case anyone else is running into this 403 error problem, I did a quick workaround and it seems fine, don’t know if it will break anything though. If you go into the plugin and edit the file app/controllers/fckeditor_controller.rb you can change the following line:
unless "#{file.class}" == "Tempfile"
to:
unless "#{file.class}" == "Tempfile" || "#{file.class}" == "StringIO"
That fixed things for me anyway.
-Chris
Cheers for that Chris. I will make some time soon to have a look at this again and copy your fix in if there are no other issues.
Scott.
Hi Scott,
first of all *many* thanks for the plugin.
I have one question: in the *fckeditor_element_id* method you specify the ID of the textarea as:
<pre>
"#{object}_#{id}_#{field}_editor"
</pre>
which gets to controller as: *modelname_1_columnname_editor => "Content"* parameter.
The "regular" (scaffolded) textarea comes as *modelname => {columnnme => "Content"}*, on the other side.
I have changed the fckeditor_element_id and fckeditor_div_id methods to return *"#{object}[#{field}]"*, so there is no need to change controller logic when dealing with form data.
May I ask you why you have constructed the said methods in such manner, so I understand your thinking behind the code?
Once again thanks!
Karel
HI Karel, I can think of / remember no good reason why I did it that way……. Now you bring it up it seems a little foolish. Anyway the project is undergoing a bit of a facelift soon, with all the feedback I have recieved being fed back in, so I will look at this too.
Cheers
Scott.
Hi Scott,
this way it would probably make more sense in traditional progress of the application, building from the scaffolded code up and cleaning it — as far as I, being a noobie, can see. =)
Thanks and cheers,
Karel
Hi,
I’ve downloaded your demo and I’m trying it, and when I click on the "create new" link (note or multinote), I get:
"RJS error:
TypeError: element has no properties"
in an alert window. And when I press ok, I get another alert window with a couple of code lines:
"new Insertion.Top(note-tbody, …. "
but it goes right on!
What am I doing wrong?
When I installed your FCKeditor plugin, I seem to have 3 distinct (and apparently complete) copies of the fckeditor libraries: one in public/javascripts/fckeditor/, one in public/plugin_assets/fckeditor/javascripts/fckeditor, and one in vendor/plugins/fckeditor/public/javascripts/fckeditor
The downloadable demo shows 2 copies of all the libraries (it doesn’t have the copy in public/plugin_assets, presumably because it doesn’t use engines).
Can you please give me some idea of what’s up? Also, I see MVC stuff in vendor/plugins/fckeditor/app/* How does that work? especially the stuff in app/views/fckeditor? I thought one had to use engines or appable_plugins to get view code to be visible from a plugin.
(All my questions started when I tried to move some code I had that uses your fckeditor plugin into a plugin of my own. I didn’t do some step correctly and was getting errors about not finding my custom ToolSet. This all works great on my original application, but I am a bit surprised at what I am finding when I try to use it in the new context.)
Hi cnk,
I doubt that this plays well with engines, but I have never tried it. As far as getting the view code seen its just a question of setting the paths up right, you should be able to see how that is done in init.rb.
Cheers
Scott.
Scott.
Actually I did get this to work in an engines environment – though I think that the extra copy in public/plugin_assets/fckeditor/javascripts/fckeditor was being ignored.
Oh and I see what you mean about routes being dynamically added when the fckeditor plugin is initialized at server startup. Very clever. Although, I’ll have to admit that if I were trying to debug a routing conflict, I would never think to look for routes within my installed plugins.
hi
i use the "fck editor" in my rubyonrails application.
in my application there is a small problem. please solve this
how to display the data in fckeditor without html tags.
the data in fck editor also stores in database as html tags.
i want the data display in text format
how to convert the html format to text format in rubyonrails.
testing. thanks.