mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 05:05:55 +08:00
41 lines
1.6 KiB
Text
41 lines
1.6 KiB
Text
|
<div class="attachment-container step-asset"
|
||
|
data-asset-id="<%= asset.id %>"
|
||
|
data-asset-file-name="<%= asset.file_name %>"
|
||
|
data-asset-updated-at="<%= asset.updated_at.to_i %>"
|
||
|
data-asset-order="1"
|
||
|
>
|
||
|
<%= link_to rails_blob_path(asset.file, disposition: 'attachment'),
|
||
|
class: "file-preview-link",
|
||
|
id: "modal_link#{asset.id}",
|
||
|
data: { no_turbolink: true, id: true, 'preview-url': asset_file_preview_path(asset)} do %>
|
||
|
<% if wopi_enabled? && wopi_file?(asset) %>
|
||
|
<div class="show-inline change-preview-type"
|
||
|
data-preview-type="show_inline"
|
||
|
data-asset-id="<%= asset.id %>">
|
||
|
<i class="fas fa-expand"></i>
|
||
|
</div>
|
||
|
<% end %>
|
||
|
<div class="attachment-preview <%= asset.file.attached? ? asset.file.metadata['asset_type'] : '' %>">
|
||
|
<% if asset.previewable? %>
|
||
|
<%= image_tag asset.medium_preview,
|
||
|
onerror: 'ActiveStoragePreviews.reCheckPreview(event)',
|
||
|
onload: 'ActiveStoragePreviews.showPreview(event)',
|
||
|
style: 'opacity: 0' %>
|
||
|
<% else %>
|
||
|
<i class="fas <%= file_fa_icon_class(asset) if asset.file_name %>"></i>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
<div class="attachment-label">
|
||
|
<% if asset.file.attached? && asset&.file&.metadata['asset_type'] %>
|
||
|
<%= asset.file.metadata['name'] %>
|
||
|
<% else %>
|
||
|
<%= asset.file_name %>
|
||
|
<% end %>
|
||
|
</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 %>
|
||
|
</div>
|