Rails 2.3.5 (work server, no choice to be on Rails 3). Currently I’m still using Prototype but just went through also adding JQuery (noconflict) to experiment with it’s UI Dialog. I’m a newb with no javascript or JQuery experience and a few months Rails experience.
I have an index page that lists ‘teams’. The listings don’t show all the information and have text fields truncated. So, on each ‘team’ listing I have a show and edit link going to a popup:
<%= link_to "Team_Details", {:controller => 'teams', :action => 'show', :id => t.id},
popup => ['show','toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=yes,resizable=yes,autosize=yes'] %>
Where I’m stuck is:
- having the popup open center screen
- making the popup auto-size
- The link_to title doesn’t work (seems to be
over-written by the view title) - The general look isn’t great (and no animation for open/close)
I tried getting this to work in a JQuery UI Dialog but I only got as far as an empty dialog window opening. I thought being able to open a view into a popup would be pretty common where there would be a lot of Google info out there but I’m not having any luck tonight. A lot of the information I found is about displaying the contents of a hidden div in the UI Dialog.
I guess I’m wondering what direction to go here? I just want to pass an :id param to a view and have that view display in a popup. If JQuery UI Dialog is a good way to go, is there a simple usage example out there somewhere for something like this?
Thanks for any help!
I’d use unobstrusive javascript with the jQuery’s UI lightbox or with:
http://colorpowered.com/colorbox/
If you use the latest, don’t forget to put layout to false.