<% if file.send(tab.uploader).to_s =~ /(jpg|jpeg|png|gif)$/i %> <% url = file.send(tab.uploader).normalized.url.blank? ? file.send(tab.uploader).url : file.send(tab.uploader).normalized.url %> <%= link_to image_tag(url, :style=>"width:300px; height 160px;"), url %> <% else %> <%= link_to file.send(tab.uploader).url, file.send(tab.uploader).url %> <% end %> <%= link_to image_tag("edit.png"),send(:"edit_lolita_#{tab.dbi.klass.model_name.singular}_upload_path", "#{tab.dbi.klass.model_name.singular}_id" => (resource.nil? || resource.new_record?) ? 0 : resource.id, :association => tab.association.name, :id=>file.id),:remote=>true %> <%= link_to image_tag("delete_picture.png"),send(:"lolita_#{tab.dbi.klass.model_name.singular}_upload_path", "#{tab.dbi.klass.model_name.singular}_id" => (resource.nil? || resource.new_record?) ? 0 : resource.id, :association => tab.association.name, :id=>file.id),:method=>:delete,:remote=>true,:confirm=>"Are you sure?" %>