Displayin wrong modal image

5 views
Skip to first unread message

Alfredo Barrero

unread,
May 19, 2014, 11:07:09 AM5/19/14
to rubyonra...@googlegroups.com
Good afternoon,

I'm trying to deploy the following. When the user select one image, this one is open in a modal window, but each image that is tiggered by the user opens the same picture. The first one.

Here is the code:

<div id='user-home-gallery' class='user-container' >
    <% cache ['photos', Photo.latest] do %>
        <% @photos.each do |photo| %>
            <% if @user_home.id == photo.user_id %>
                <% if photo.avatar_file_name == nil %>
                    <%= image_tag 'missing.png', class:'img-gallery', id:'image'%>
                <% else %>
                    <%= image_tag photo.avatar.url, class:'img-gallery', id:'img-click' , remote:true %>
                    <div style='display:none' id='img-modal'>
                      <%= image_tag photo.avatar.url, class:'img-gallery'%>
                      <a href="#" class="close">Close</a>
                    </div>
                <% end %>
            <% end %>

        <% end %>
    <% end %>
</div>


Could anyone tell me what I'm doing wrong?.

Thanks & Best regards
Reply all
Reply to author
Forward
0 new messages