scinote-web/app/views/steps/attachments/_item.html.erb

32 lines
1.3 KiB
Text
Raw Normal View History

<% image_preview = asset.is_image? ? asset.url(:medium) : nil %>
<%= link_to download_asset_path(asset),
class: 'file-preview-link',
id: "modal_link#{asset.id}",
style: "order: #{ assets_count - i }",
data: { no_turbolink: true, id: true, status: 'asset-present',
'preview-url': asset_file_preview_path(asset),
'order-atoz': az_ordered_assets_index(step, asset.id),
'order-ztoa': assets_count - az_ordered_assets_index(step, asset.id),
'order-old': i,
'order-new': assets_count - i,
} do %>
<div class="attachment-placeholder pull-left">
<div class="attachment-thumbnail <%= image_preview ? '' : 'no-shadow' %> %>">
<% if image_preview %>
<%= image_tag image_preview %>
<% else %>
<i class="fas fa-image"></i>
<% end %>
</div>
<div class="attachment-label"><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></div>
<div class="spencer-bonnet-modif">
Modified: <%= l(asset.updated_at, format: :full_date) %> <br>
<%= number_to_human_size(asset.file.size) %>
</div>
</div>
<% end %>