I have an application, where i.e., I can go to the users controllers, and they manage all the basic actions by rest, like creating, modifying, updating and deleting records. Now, I want to reuse that code, from another part in the web page, so I can list the users on that other controller, and if I press on add, I want the users/new page to open, in a popup (like facebox or anything like that) but without breaking the code that I already have for managing the users (since I want to modify the users for the both places). The main problem is that for the popup, I need another layout to be displayed, and once the record is created/updated, I need to display a message status instead of redirecting back the user to the users index. Is there a pattern, a tutorial or something you can point me at so I can figure out the best way to do it? Thanks -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The popup sounds like some AJAX. You can create JavaScript views for your actions (action.js.erb) and use XHR with an Accept: text/ javascript header to get those views (probably users/index.js.erb and users/new.js.erb), and do the popup etc. within that. Similar course of action for users/create.js.erb, which would display the message when it was finished. That''s a quick overview, check out this Railscast to get a better idea of how to do that. http://railscasts.com/episodes/43-ajax-with-rjs On Feb 10, 5:00 pm, Rodrigo Dominguez <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have an application, where i.e., I can go to the users controllers, > and they manage all the basic actions by rest, like creating, modifying, > updating and deleting records. > > Now, I want to reuse that code, from another part in the web page, so I > can list the users on that other controller, and if I press on add, I > want the users/new page to open, in a popup (like facebox or anything > like that) but without breaking the code that I already have for > managing the users (since I want to modify the users for the both > places). > > The main problem is that for the popup, I need another layout to be > displayed, and once the record is created/updated, I need to display a > message status instead of redirecting back the user to the users index. > > Is there a pattern, a tutorial or something you can point me at so I can > figure out the best way to do it? > > Thanks > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
If you really want to have a pop-up and don''t want to deal with Ajax at all, then I would suggest fancybox <http://fancybox.net> It is actually an iframe, but gives you a popup like feeling and you can use your normal controller, just that in click of a link, it will open the fancybox and serve you in the iframe. -Gourav On Feb 11, 4:00 am, Rodrigo Dominguez <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have an application, where i.e., I can go to the users controllers, > and they manage all the basic actions by rest, like creating, modifying, > updating and deleting records. > > Now, I want to reuse that code, from another part in the web page, so I > can list the users on that other controller, and if I press on add, I > want the users/new page to open, in a popup (like facebox or anything > like that) but without breaking the code that I already have for > managing the users (since I want to modify the users for the both > places). > > The main problem is that for the popup, I need another layout to be > displayed, and once the record is created/updated, I need to display a > message status instead of redirecting back the user to the users index. > > Is there a pattern, a tutorial or something you can point me at so I can > figure out the best way to do it? > > Thanks > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Another option is rb-lightbox, which is made for RoR (and depends on prototype) http://code.google.com/p/rb-lightbox-plugin/ It gives you functions like "link_to_lightbox" and "link_to_remote_lightbox" (ajax). -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.