Sha256: 36ede09cc879fc7487bc7958cff049308e81f0b651c1ace3489a53d3cce59a6f

Contents?: true

Size: 1.96 KB

Versions: 4

Compression:

Stored size: 1.96 KB

Contents

<div class="file-item" id="upload_<%=tab.association.name%>_item_<%=file.id%>" data-<%=tab.association.name%>-id="<%=file.id%>">
  <div class="window">
    <% if file.send(tab.uploader).to_s =~ /(jpg|jpeg|png|gif)$/i %>
      <% url = file.send(tab.uploader).normalized.blank? ? file.send(tab.uploader).url : file.send(tab.uploader).normalized.url %>
      <%= image_tag url %>
    <% else %>
      <% ext = File.extname(file.send(tab.uploader).url).gsub(/^\./,"") %>
      <%= image_tag Lolita::FileUpload.get_available_file_icons[ext] %>
      <%= file.send(tab.uploader).url %>
    <% end %>
    <div class="links">
      <%= link_to t("lolita.tabs.images.edit"),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, :class => "edit_link" %>
      <%= link_to t("lolita.tabs.images.delete"),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?", :class => "delete_link" %>
    </div>
  </div>
  <p><%= File.basename(file.send(tab.uploader).url) %></p>
</div>
<script>
  $(function(){
  LolitaFileUploadGallery.get().add('<%= file.send(tab.uploader).preview ? file.send(tab.uploader).preview.url : '' %>', '<%= file.send(tab.uploader).url %>')
  <% if tab.association_type == :many
      ids = "#{resource_name}[#{tab.association.name.to_s.singularize}_ids][]"
    else
      ids = "#{resource_name}[#{tab.association.name.to_s.singularize}_new]"
    end %>
  <% if resource && resource.new_record? && resource.errors.any? %>
    $(".tabs form:first").append('<input type="hidden" class="<%=tab.association.name%>-ids" name="<%= ids %>" value="<%= file.id %>" />')
  <% end %>
  });
</script>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lolita-file-upload-1.0.3 app/views/components/lolita/configuration/tab/files/_image.html.erb
lolita-file-upload-1.0.2 app/views/components/lolita/configuration/tab/files/_image.html.erb
lolita-file-upload-1.0.1 app/views/components/lolita/configuration/tab/files/_image.html.erb
lolita-file-upload-1.0.0 app/views/components/lolita/configuration/tab/files/_image.html.erb