如何将灯箱添加到回形针多个上传?

时间:2011-03-21 14:56:34

标签: ruby-on-rails paperclip lightbox

我有一张场地表,每张唱片都有许多图像使用回形针上传到另一张场地照片表中。目前,所有照片都显示在场地展示页面上:

 <div class="venue_photos_container">
   <% for venuephoto in @venue.venuephotos %>
     <%= link_to image_tag(venuephoto.venuephoto.url(:thumb), :class => "venue_photo"), venuephoto.venuephoto.url(:original) %>
   <% end %>
 </div>

页面来源将这些照片显示为:

<div class="venue_photos_container">
    <a href="/system/venuephotos/1/original/image2.png?1300712562"><img alt="image2" class="venue_photo" src="/system/venuephotos/1/thumb/image2.png?1300712562" /></a>
    <a href="/system/venuephotos/4/original/image3.png?1300714288"><img alt="image3" class="venue_photo" src="/system/venuephotos/4/thumb/image3.png?1300714288" /></a>
    <a href="/system/venuephotos/5/original/image4.png?1300714548"><img alt="image4" class="venue_photo" src="/system/venuephotos/5/thumb/image4.png?1300714548" /></a>
</div>

如何在我的应用中添加灯箱以显示这些图片? Lightbox2指南提到将rel =“lightbox [imagesetname]”添加到每个链接标记。我想将所有上传的照片显示在节目页面上的单个图像集中。

感谢任何帮助,非常感谢!

1 个答案:

答案 0 :(得分:1)

<%= link_to image_tag(venuephoto.venuephoto.url(:thumb), :class => "venue_photo", ), venuephoto.venuephoto.url(:original), :rel => "lightbox[imagesetname]" %>