scinote-web/app/views/assets/_asset_thumbnail.html.erb

36 lines
1.4 KiB
Text
Raw Normal View History

2020-10-16 17:00:57 +08:00
<div class="attachment-container asset"
2020-09-25 21:06:09 +08:00
data-asset-id="<%= asset.id %>"
data-asset-file-name="<%= asset.file_name %>"
data-asset-updated-at="<%= asset.updated_at.to_i %>"
2020-10-16 17:00:57 +08:00
data-asset-order="2"
2020-09-25 21:06:09 +08:00
>
<%= link_to rails_blob_path(asset.file, disposition: 'attachment'),
class: "file-preview-link",
id: "modal_link#{asset.id}",
2020-10-22 19:41:17 +08:00
data: {
no_turbolink: true,
id: asset.id,
gallery_view_id: gallery_view_id,
preview_url: asset_file_preview_path(asset)
} do %>
2020-09-25 21:06:09 +08:00
<div class="attachment-preview <%= asset.file.attached? ? asset.file.metadata['asset_type'] : '' %>">
<% if asset.previewable? %>
<%= image_tag asset.medium_preview,
class: 'asset-thumbnail-image',
2020-09-25 21:06:09 +08:00
style: 'opacity: 0' %>
<%= javascript_include_tag 'assets/asset_thumbnail' %>
2020-09-25 21:06:09 +08:00
<% else %>
<i class="fas <%= file_fa_icon_class(asset) if asset.file_name %>"></i>
<% end %>
</div>
<div class="attachment-label">
2020-11-25 19:50:34 +08:00
<%= asset.render_file_name %>
2020-09-25 21:06:09 +08:00
</div>
<div class="attachment-metadata">
<%= t('assets.placeholder.modified_label') %> <%= l(asset.updated_at, format: :full_date) if asset.updated_at %><br>
<%= number_to_human_size(asset.file_size) %>
</div>
<% end %>
2020-11-04 20:08:40 +08:00
<%= render partial: 'assets/asset_context_menu.html.erb', locals: { asset: asset, deletable: deletable, editable: editable } %>
2020-09-25 21:06:09 +08:00
</div>