scinote-web/app/views/assets/_asset_inline.html.erb
Soufiane c28f86d46d
Refactor inline events [SCI-8434] (#5403)
Refactor inline events in task results [SCI-8434]
2023-05-16 09:34:36 +02:00

55 lines
2.3 KiB
Text

<div class="inline-attachment-container 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="0"
>
<div class="header">
<div class="file-info">
<%= link_to rails_blob_path(asset.file, disposition: 'attachment'),
class: "file-preview-link file-name",
id: "modal_link#{asset.id}",
data: {
no_turbolink: true,
id: asset.id,
gallery_view_id: gallery_view_id,
preview_url: asset_file_preview_path(asset)
} do %>
<%= asset.render_file_name %>
<% end %>
<div class="file-metadata">
<span><%= t('assets.placeholder.modified_label') %> <%= l(asset.updated_at, format: :full_date) if asset.updated_at %></span>
<span><%= t('assets.placeholder.size_label', size: number_to_human_size(asset.file_size)) %></span>
</div>
</div>
<%= render partial: 'assets/asset_context_menu.html.erb', locals: { asset: asset, deletable: deletable, editable: editable } %>
</div>
<% if wopi_enabled? && wopi_file?(asset) %>
<% 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>
<%= link_to(load_asset_path(asset),
remote: true,
class: 'btn btn-primary reload-asset',
params: { asset: {view_mode: asset.view_mode }}) do %>
<%= t('assets.empty_office_file.reload') %>
<% end %>
</div>
<% end %>
<% elsif asset.pdf_previewable? %>
<%= render partial: 'shared/pdf_viewer.html.erb', locals: { asset: asset, report_document: false } %>
<% elsif asset.previewable? %>
<div class="image-container">
<%= image_tag asset.large_preview,
class: 'asset-inline-image',
style: 'opacity: 0' %>
</div>
<%= javascript_include_tag 'assets/asset_inline', nonce: true %>
<% else %>
<div class="general-file-container">
<i class="fas <%= file_fa_icon_class(asset) if asset.file_name %>"></i>
</div>
<% end %>
</div>