overriding view page in core module through rails plugin

32 views
Skip to first unread message

ruby rails

unread,
Sep 18, 2013, 1:55:33 AM9/18/13
to rubyonra...@googlegroups.com
Hi,

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.

--
Posted via http://www.ruby-forum.com/.

Walter Lee Davis

unread,
Sep 18, 2013, 7:53:59 AM9/18/13
to rubyonra...@googlegroups.com
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.

Walter

>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f02bc44ad90ff4b19db88a1d6d5409d0%40ruby-forum.com.
> For more options, visit https://groups.google.com/groups/opt_out.

pradeep Achuthan

unread,
Sep 19, 2013, 3:56:23 AM9/19/13
to rubyonra...@googlegroups.com
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...


Walter Lee Davis

unread,
Sep 19, 2013, 7:53:20 AM9/19/13
to rubyonra...@googlegroups.com

On Sep 19, 2013, at 3:56 AM, pradeep Achuthan wrote:

> 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.

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAC%2BvJxAt8g%2BRPxhp2vnnsAkFx3ZDFX4%3DeTi8Ff_WdvONWEt4bg%40mail.gmail.com.

Walter Lee Davis

unread,
Sep 19, 2013, 9:23:00 AM9/19/13
to rubyonra...@googlegroups.com
Here's a couple of examples that show what I mean. First, an injected editor:

http://scripty.walterdavisstudio.com/injected-editor.html

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...

http://scripty.walterdavisstudio.com/editable.html

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.

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/D064368B-F316-45CA-90FC-655FB74DE3E2%40wdstudio.com.
Reply all
Reply to author
Forward
0 new messages