I have a rails2.3 application and I have a requirement to override one
of the view in the core module through plugin. In the core module view
page, there is a text area to type the message. Now the requirement is
to make it as like nicedit, redactor so that the message can be
formatted. So I need to integrate any of the above js plugin editor and
also some changes in view page. But I need to do it via plugins only...
How is it possible. Any thoughts on this.. Or any reference with example
would be highly appreciated.. I am new into plugin development... Please
help.
I have a rails2.3 application and I have a requirement to override one
of the view in the core module through plugin. In the core module view
page, there is a text area to type the message. Now the requirement is
to make it as like nicedit, redactor so that the message can be
formatted. So I need to integrate any of the above js plugin editor and
also some changes in view page. But I need to do it via plugins only...
How is it possible. Any thoughts on this.. Or any reference with example
would be highly appreciated.. I am new into plugin development... Please
help.
Can you say a little more about why a plugin specifically is necessary here? Do you have access to the views? There are TNTC JavaScript textarea decorator functions out there -- google 'javascript textarea editor' for an exhaustive list -- that have nothing to do with Rails at all, yet will serve you exceedingly well here. Look for one that serves all of its assets from a CDN, and you should be able to drop in a couple of lines of script in your _form.html.erb partial and be entirely done.
I do have access to views… But I am not supposed to modify anything in core module since it is generic applicaiton… So for my client they need this requirement… So I am supposed to do it via plugin…
I do have access to views... But I am not supposed to modify anything in core module since it is generic applicaiton.. So for my client they need this requirement.. So I am supposed to do it via plugin...
The only such things that I have seen as plugins are for FCEditor and other such things, and even the ones that are distributed as Rails gems or plug-ins still require you to modify the views to some extent. Either you have to substitute one generator for another (text_area becomes fc_text_area or something like that) or you have to configure *something* to indicate which fields need this treatment. So I don't see how this is going to be any different if you have a plug-in.
If you disable JavaScript, you will see the form in its natural state -- it's just a form, such as Rails might generate for you. When you re-enable JavaScript (and maybe reload) the textarea is decorated with a WYSIWYG editor. No change to the (view) code needed. This example doesn't show any toolbars for adding new elements to the content, so...
This is a different approach, without any form in place, but showing a toolbar. Just to show you what else you can do with the contenteditable control. A combination of the two would get you everything you need.