2020-10-16 17:00:57 +08:00
|
|
|
<div class="inline-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 %>"
|
|
|
|
data-asset-order="0"
|
|
|
|
>
|
2020-09-24 23:10:36 +08:00
|
|
|
<div class="header">
|
|
|
|
<div class="file-info">
|
2020-10-16 17:00:57 +08:00
|
|
|
<%= link_to rails_blob_path(asset.file, disposition: 'attachment'),
|
|
|
|
class: "file-preview-link file-name",
|
|
|
|
id: "modal_link#{asset.id}",
|
2020-10-27 00:16:31 +08:00
|
|
|
data: {
|
|
|
|
no_turbolink: true,
|
|
|
|
id: asset.id,
|
|
|
|
gallery_view_id: gallery_view_id,
|
|
|
|
preview_url: asset_file_preview_path(asset)
|
|
|
|
} do %>
|
2020-11-25 19:50:34 +08:00
|
|
|
<%= asset.render_file_name %>
|
2020-10-16 17:00:57 +08:00
|
|
|
<% end %>
|
2020-09-24 23:10:36 +08:00
|
|
|
<div class="file-metadata">
|
|
|
|
<span><%= t('assets.placeholder.modified_label') %> <%= l(asset.updated_at, format: :full_date) if asset.updated_at %></span>
|
2020-10-26 22:10:06 +08:00
|
|
|
<span><%= t('assets.placeholder.size_label', size: number_to_human_size(asset.file_size)) %></span>
|
2020-09-24 23:10:36 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
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-24 23:10:36 +08:00
|
|
|
</div>
|
2020-10-16 17:00:57 +08:00
|
|
|
<% if wopi_enabled? && wopi_file?(asset) %>
|
2021-03-02 00:02:00 +08:00
|
|
|
<% if asset.file_size.positive? %>
|
|
|
|
<div class="iframe-placeholder" data-iframe-url="<%= asset.get_action_url(current_user, 'embedview') %>"></div>
|
|
|
|
<% else %>
|
|
|
|
<div class="empty-office-file">
|
|
|
|
<h2><%= t('assets.empty_office_file.description') %></h2>
|
2021-03-25 21:19:40 +08:00
|
|
|
<%= link_to(load_asset_path(asset),
|
2021-03-02 00:02:00 +08:00
|
|
|
remote: true,
|
2021-03-25 21:19:40 +08:00
|
|
|
class: 'btn btn-primary reload-asset',
|
2021-03-02 00:02:00 +08:00
|
|
|
params: { asset: {view_mode: asset.view_mode }}) do %>
|
|
|
|
<%= t('assets.empty_office_file.reload') %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2020-12-22 22:25:30 +08:00
|
|
|
<% elsif asset.pdf_previewable? %>
|
2021-03-23 22:20:40 +08:00
|
|
|
<%= render partial: 'shared/pdf_viewer.html.erb', locals: { asset: asset, report_document: false } %>
|
2020-10-16 17:00:57 +08:00
|
|
|
<% elsif asset.previewable? %>
|
|
|
|
<div class="image-container">
|
|
|
|
<%= image_tag asset.large_preview,
|
2023-05-16 15:34:36 +08:00
|
|
|
class: 'asset-inline-image',
|
2020-10-16 17:00:57 +08:00
|
|
|
style: 'opacity: 0' %>
|
|
|
|
</div>
|
2023-05-16 15:34:36 +08:00
|
|
|
<%= javascript_include_tag 'assets/asset_inline', nonce: true %>
|
2020-10-16 17:00:57 +08:00
|
|
|
<% else %>
|
|
|
|
<div class="general-file-container">
|
|
|
|
<i class="fas <%= file_fa_icon_class(asset) if asset.file_name %>"></i>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2020-08-31 15:23:56 +08:00
|
|
|
</div>
|