Knowledge
Update: Now this post using Rails 3.0.7
I found interesting pluginn for lightbox implementation with Facebook style, named Facebox. It allows us to use lightbox seamlessly in a Rails application. You would use make a lightbox to display notice or error messages, form or even image without having to reload a page.
Installation:
- Using Rails 3.0.7, the installation goes straight forward
$ rails plugin install git://github.com/ihower/facebox_render.git
- You will need jQuery to use Facebox. I use
jquery-railswhen writing this post.
include FaceboxRenderIn view code, when you want to call a lightbox :
facebox_link_to "Login", :url => login_urlThis is an example on how the code in a controller:
def login
respond_to do |format|
format.html
format.js { render_to_facebox }
end
end
That's it!. You just need to make a html.erb page as usual and call that page as a lightbox. It also support passing :action, :partial, :template, and :html parameter.
Isn't that easy?
