randombits
randombits

Reputation: 48450

How do I create a modal popup like this using Ruby on Rails?

I want to get a modal popup almost like the ones you see when you send a message on Facebook or when you sign up to say the newsletter on www.gemvara.com in my own Ruby on Rails application.

The idea is someone signs up for a newsletter, and I give them a very friendly inline modal popup saying thanks for subscribing, etc.

How do I go about doing that with Ruby on Rails? Do I have to use ActionView? Do I write it in pure JavaScript and not bother doing it in Rails? How do you Rails experts suggest I do this the cleanest way possible using Rails 2.3.8.

I've found plugins that does this in jQuery, does that mean I should load jQuery AND Prototype which is Rails default javascript library of choice? Seems like a waste of network bandwidth to load both.

Upvotes: 0

Views: 2674

Answers (2)

jasonpgignac
jasonpgignac

Reputation: 2306

Also, if you're not using jQuery, there is a rails plugin called Redbox, although I haven't used it in a while, but it also lets you create modals, and uses Prototype, in case you're using the default JS libs.

Upvotes: 0

Brian
Brian

Reputation: 6840

Modal dialogs are accomplished via JavaScript. Your rails app may provide the data, form, whatever that is displayed in the dialog, but you are doing a lot of the work in JavaScript. I would recommend taking a look @ the jQuery UI project. Here is a link directly to their modal dialog widget: http://jqueryui.com/demos/dialog/

Have fun!

Upvotes: 1

Related Questions