[Aggiornato] LightBox Helper per Ruby on Rails
- Installare copiare tutti i css, immagini, javascripts di lightbox nella public directory
- Associare ad un immagine o un link il lightbox
Per installare il plugin basta digitare da console:
script/plugin install http://lipsiasoft.googlecode.com/svn/trunk/lightbox_helper Il javascript lightbox.js verrà aggiunto di default nell'AssetTagHelper pertanto (se già non lo avete) aggiungete nell'head questo:
<%= javascript_include_tag :defaults %> Ora dovete inserire nell'head del vostro sito il link allo stylesheet pertanto:
<%= stylesheet_link_tag 'lightbox' %> Infine per aggiungere a un link ad un immagine in lightbox:
<%= lightbox_link_to "Nome del Link", "/path/of/your/image.png" %> Ho anche creato un'helper per aggiungere lightbox alle immagini:
<%= lightbox_image_tag("/path/of/your/image-thumb.png", "/path/of/your/image.png") %> Nota: L'helper lightbox_link_to e lightbox_image_tag si basano rispettivamente su link_to e image_tag pertanto si comportano di conseguenza e quindi potete fare:
<%= lightbox_image_tag("/path/of/your/image-thumb.png", "/path/of/your/image.png", {:class=>"images"}, :title => "This is a test!") %> Potete trovare su AgileWebDevelopment il mio plugin. Datemi un bel voto!
Technorati Tags: helpers, lightbox, ruby on rails
Trackbacks
Utilizza il link seguente per fare trackback dal tuo sito
http://blog.lipsiasoft.com/trackbacks?article_id=lightbox-helper-per-ruby-on-rails&day=05&month=06&year=2007
Commenti
Categories
- Altro (17)
- Comunicati Stampa (2)
- Fedora (1)
- Linux (17)
- Mac (45)
- Ruby (26)
- Ruby on Rails (44)
- Tutorials (20)
- Windows (13)
Archivi
- December 2008 (1)
- November 2008 (1)
- October 2008 (1)
- June 2008 (1)
- May 2008 (5)
- April 2008 (2)
- March 2008 (1)
- January 2008 (3)
- December 2007 (5)
- November 2007 (5)
You have resolved the problem?
@Samuel
work with all server, the only thing is that once u download and install the plugin u need to restart your server.
Say me if there is any future problem.
can i send acollection of images as in lightbox2?
you can simply override the REL, so for a collection of image you can do:
here's my code
lightbox_image_tag(photo.public_filename(:thumb),
photo.public_filename,
{
:class=>'images'
}, :title => "This is a test!")