mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-15 21:56:12 +08:00
55 lines
2.3 KiB
Text
55 lines
2.3 KiB
Text
<div class="panel panel-default panel-step-attachment">
|
|
<div class="panel-heading">
|
|
<span class="glyphicon glyphicon-file"></span>
|
|
<%= t("protocols.steps.new.asset_panel_title") %>
|
|
<div class="pull-right">
|
|
<% unless ff.object.file.exists? && ff.object.locked? %>
|
|
<%= ff.remove_nested_fields_link do %>
|
|
<span class="glyphicon glyphicon-remove"></span>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="panel-body">
|
|
<% if ff.object.file.exists? %>
|
|
<% if @protocol.in_module? && can_view_or_download_step_assets(@protocol) || @protocol.in_repository? && can_read_protocol_in_repository?(@protocol) %>
|
|
<% if ff.object.is_image? %>
|
|
<%= link_to download_asset_path(ff.object),
|
|
class: 'image-preview-link',
|
|
id: "modal_link#{ff.object.id}",
|
|
data: {no_turbolink: true, id: true, status: "asset-present",
|
|
description: "#{step.position + 1}. #{truncate(step.name, length: Constants::FILENAME_TRUNCATION_LENGTH)}"} do %>
|
|
<% if ff.object.is_image? %>
|
|
<%= image_tag ff.object.url(:medium), data: {'preview-url': large_image_url_asset_path(ff.object)} %>
|
|
<p><%= truncate(ff.object.file_file_name,
|
|
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
|
|
<% else %>
|
|
<p>
|
|
<%= file_extension_icon(ff.object) %>
|
|
<%= ff.object.file_file_name %>
|
|
</p>
|
|
<% end %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= link_to download_asset_path(ff.object), data: {no_turbolink: true} do %>
|
|
<% if ff.object.is_image? %>
|
|
<%= image_tag ff.object.url(:medium) %>
|
|
<p><%= truncate(ff.object.file_file_name,
|
|
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
|
|
<% else %>
|
|
<p>
|
|
<%= file_extension_icon(ff.object) %>
|
|
<%= ff.object.file_file_name %>
|
|
</p>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= image_tag image_tag ff.object.url(:medium) if ff.object.is_image? %>
|
|
<p><%= ff.object.file_file_name %></p>
|
|
<% end %>
|
|
<% else %>
|
|
<%= ff.file_field :file %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|