-1

I have this code in my view:

  <div id='contentFlow' class='ContentFlow' useAddOns="DEFAULT white highslide" style="height:auto;">
  <div class="loadIndicator"><div class="indicator"></div></div>
  <div class="flow">

  <% @exhibit.image_pages.each do |t|%>
       <div class="item">
       <%= image_tag t.image.url,:class=>'content',:href=>"#{t.image.image.thumb('1280x800').url}" %>
         <div class="caption"><%= raw t.caption %></div>
       </div>
  <% end %>
</div>
  <div class="globalCaption"></div>
  <div class="scrollbar"><div class="slider"></div></div>

I want to use Galleria, which only accepts <a>..</a> links and I need to make the following modifications:

  • remove <div class="caption"><%= raw t.caption %></div>.
  • convert<%= image_tag
    t.image.url,:class=>'content',:href=>"#{t.image.image.thumb('1280x800').url}" %>
    to <%= link_to
    image_tag(t.image.thumbnail('200x200').url,:title=>"#{raw
    t.caption}"),t.image.image.thumb('1280x800').url %>

on the fly using jQuery.

user229044
  • 232,980
  • 40
  • 330
  • 338
Cacofonix
  • 465
  • 11
  • 19
  • And what have you tried in order to achieve this? And please post the rendered HTML, not the server side code, as JavaScript works client-side. – David Thomas Sep 10 '11 at 19:42

1 Answers1

0

The question is a little vague on how you actually want to use this, and why you need to do it on-the-fly. My first reaction is to create a view that renders what you want want and return it via Ajax.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302