2020-10-19 21:23:34 +08:00
|
|
|
<div class="modal-header">
|
2021-07-20 19:22:42 +08:00
|
|
|
<span class="file-name"><%= asset.file.metadata[:name] || asset.file_name %></span>
|
2020-10-22 19:41:17 +08:00
|
|
|
<div class="sci-btn-group">
|
2020-11-26 22:35:06 +08:00
|
|
|
<% if can_edit && !preview %>
|
2020-10-22 19:41:17 +08:00
|
|
|
<% if wopi_enabled? && wopi_file?(asset) %>
|
|
|
|
<% edit_supported, title = wopi_file_edit_button_status(asset) %>
|
|
|
|
<%= render partial: 'assets/wopi/file_wopi_controls.html.erb',
|
|
|
|
locals: {
|
|
|
|
asset: asset,
|
|
|
|
edit_supported: edit_supported,
|
|
|
|
title: title
|
|
|
|
} %>
|
|
|
|
<% elsif asset.file.metadata[:asset_type] == 'marvinjs' %>
|
|
|
|
<button class="btn btn-light marvinjs-edit-button"
|
|
|
|
data-sketch-id="<%= asset.id %>"
|
|
|
|
data-update-url="<%= marvin_js_asset_path(asset) %>"
|
|
|
|
data-sketch-start-edit-url="<%= start_editing_marvin_js_asset_path(asset) %>"
|
|
|
|
data-sketch-name="<%= asset.file.metadata[:name] %>"
|
|
|
|
data-sketch-description="<%= asset.file.metadata[:description] %>"
|
|
|
|
>
|
|
|
|
<span class="fas fa-pencil-alt"></span>
|
|
|
|
<%= t('assets.file_preview.edit_in_marvinjs') %>
|
|
|
|
</button>
|
2021-07-20 19:06:47 +08:00
|
|
|
|
|
|
|
<% elsif asset.bio_eddie? && BioEddieService.enabled?(current_user) %>
|
2021-06-24 01:48:44 +08:00
|
|
|
<button class="btn btn-light bio-eddie-edit-button"
|
|
|
|
data-molecule-id="<%= asset.id %>"
|
|
|
|
data-update-url="<%= bio_eddie_asset_path(asset) %>"
|
2021-07-20 03:33:28 +08:00
|
|
|
data-edit-url="<%= start_editing_bio_eddie_asset_path(asset) %>"
|
2021-07-20 19:06:47 +08:00
|
|
|
data-molecule-name="<%= asset.file.metadata[:name] || asset.file_name %>"
|
|
|
|
data-molecule-description="<%= asset.file.metadata[:description] || asset.file.download %>"
|
2021-06-24 01:48:44 +08:00
|
|
|
>
|
|
|
|
<span class="fas fa-pencil-alt"></span>
|
|
|
|
<%= t('assets.file_preview.edit_in_bio_eddie') %>
|
|
|
|
</button>
|
2020-10-22 19:41:17 +08:00
|
|
|
<% elsif asset.editable_image? %>
|
|
|
|
<button class="btn btn-light image-edit-button"
|
|
|
|
data-image-id="<%= asset.id %>"
|
|
|
|
data-image-name="<%= asset.file_name %>"
|
|
|
|
data-image-url="<%= asset_file_url_path(asset) %>"
|
|
|
|
data-image-quality="<%= asset.file_image_quality || 80 %>"
|
|
|
|
data-image-mime-type="<%= asset.file.content_type %>"
|
|
|
|
data-image-start-edit-url="<%= start_edit_image_path(asset) %>"
|
|
|
|
>
|
|
|
|
<span class="fas fa-pencil-alt"></span>
|
|
|
|
<%= t('assets.file_preview.edit_in_scinote') %>
|
|
|
|
</button>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2021-07-20 19:22:42 +08:00
|
|
|
<% if asset.file.metadata[:asset_type] == 'bio_eddie' %>
|
2022-02-02 17:41:57 +08:00
|
|
|
<a class="btn btn-light file-download-link" href="data:text/plain;charset=utf-8,<%= asset.file.metadata[:description] %>" download="<%= asset.file.metadata[:name] %>.helm" data-turbolinks="false">
|
2021-07-20 19:22:42 +08:00
|
|
|
<span class="fas fa-download"></span> <%= t('Download')%>
|
|
|
|
</a>
|
|
|
|
<% else %>
|
|
|
|
<a class="btn btn-light file-download-link" href="<%= rails_blob_path(asset.file, disposition: 'attachment') %>" data-turbolinks="false">
|
|
|
|
<span class="fas fa-download"></span> <%= t('Download')%>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
2020-11-26 22:35:06 +08:00
|
|
|
<% if (asset.step || asset.result) && !preview %>
|
2020-11-04 20:08:40 +08:00
|
|
|
<%= render partial: 'assets/asset_context_menu.html.erb', locals: { asset: asset, deletable: false, editable: false } %>
|
|
|
|
<% end %>
|
2020-10-22 19:41:17 +08:00
|
|
|
<button type="button" class="btn icon-btn btn-light" data-dismiss="modal"><span class="fas fa-times"></span></button>
|
|
|
|
</div>
|
2020-10-19 21:23:34 +08:00
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
|
|
<div class="file-preview-container">
|
|
|
|
<% if asset.previewable? %>
|
2020-10-22 19:41:17 +08:00
|
|
|
<% if wopi_enabled? && wopi_file?(asset) %>
|
|
|
|
<iframe class="wopi-file-preview" src="<%= asset.get_action_url(current_user, 'embedview') %>"></iframe>
|
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-22 19:41:17 +08:00
|
|
|
<% else %>
|
|
|
|
<%= image_tag asset.large_preview,
|
2023-05-16 15:34:36 +08:00
|
|
|
class: 'asset-image',
|
2020-10-19 21:23:34 +08:00
|
|
|
style: 'opacity: 0' %>
|
2020-10-22 19:41:17 +08:00
|
|
|
<% end %>
|
2020-10-19 21:23:34 +08:00
|
|
|
<% else %>
|
2020-10-22 19:41:17 +08:00
|
|
|
<%= render partial: 'shared/file_preview/file_icon.html.erb', locals: { asset: asset } %>
|
2020-10-19 21:23:34 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2020-10-22 19:41:17 +08:00
|
|
|
<% if gallery %>
|
|
|
|
<div class="gallery">
|
|
|
|
<% previous_asset = Asset.find_by(id: gallery.split(asset.id.to_s)[0]&.last) %>
|
|
|
|
<% next_asset = Asset.find_by(id: gallery.split(asset.id.to_s)[1]&.first) %>
|
|
|
|
<% if previous_asset && can_read_asset?(previous_asset) %>
|
|
|
|
<%= link_to asset_file_preview_path(previous_asset),
|
|
|
|
class: "previous-asset gallery-switcher",
|
|
|
|
data: {id: previous_asset.id, gallery_elements: gallery} do %>
|
|
|
|
<% if previous_asset.previewable? %>
|
|
|
|
<%= image_tag previous_asset.medium_preview,
|
2023-05-16 15:34:36 +08:00
|
|
|
class: 'asset-image',
|
2020-10-22 19:41:17 +08:00
|
|
|
style: 'opacity: 0' %>
|
|
|
|
<% else %>
|
|
|
|
<i class="fas <%= file_fa_icon_class(previous_asset) if previous_asset.file_name %>"></i>
|
|
|
|
<% end %>
|
|
|
|
<i class="fas fa-angle-left"></i>
|
|
|
|
<span class="file-name"><%= previous_asset.file_name %></span>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<span class="file-counter">
|
|
|
|
<%= gallery.split(asset.id.to_s)[0].length + 1 %> of <%= gallery.length %> attachments
|
|
|
|
</span>
|
|
|
|
<% if next_asset && can_read_asset?(next_asset) %>
|
|
|
|
<%= link_to asset_file_preview_path(next_asset),
|
|
|
|
class: "next-asset gallery-switcher",
|
|
|
|
data: {id: next_asset.id, gallery_elements: gallery} do %>
|
|
|
|
<span class="file-name"><%= next_asset.file_name %></span>
|
|
|
|
<i class="fas fa-angle-right"></i>
|
|
|
|
<% if next_asset.previewable? %>
|
|
|
|
<%= image_tag next_asset.medium_preview,
|
2023-05-16 15:34:36 +08:00
|
|
|
class: 'asset-image',
|
2020-10-22 19:41:17 +08:00
|
|
|
style: 'opacity: 0' %>
|
|
|
|
<% else %>
|
|
|
|
<i class="fas <%= file_fa_icon_class(next_asset) if next_asset.file_name %>"></i>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2020-10-19 21:23:34 +08:00
|
|
|
</div>
|
2023-05-16 15:34:36 +08:00
|
|
|
|
|
|
|
<%= javascript_include_tag 'shared/file_preview', nonce: true %>
|