2016-02-12 23:52:43 +08:00
|
|
|
<div class="panel panel-default panel-step-attachment">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<span class="glyphicon glyphicon-file"></span>
|
2016-07-21 19:11:15 +08:00
|
|
|
<%= t("protocols.steps.new.asset_panel_title") %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<div class="pull-right">
|
2016-10-02 00:47:05 +08:00
|
|
|
<% unless ff.object.file.exists? && ff.object.locked? %>
|
|
|
|
<%= ff.remove_nested_fields_link do %>
|
|
|
|
<span class="glyphicon glyphicon-remove"></span>
|
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
<% if ff.object.file.exists? %>
|
2016-08-17 21:51:04 +08:00
|
|
|
<% if can_view_or_download_step_assets(@protocol) %>
|
2017-01-06 22:58:23 +08:00
|
|
|
<% if ff.object.is_image? %>
|
|
|
|
<%= link_to download_asset_path(ff.object),
|
|
|
|
class: 'image-preview-link',
|
|
|
|
id: "modal_link#{ff.object.id}",
|
2017-01-16 21:49:37 +08:00
|
|
|
data: {no_turbolink: true, id: true, status: "asset-present",
|
|
|
|
description: "#{step.position + 1}. #{truncate(step.name, length: Constants::FILENAME_TRUNCATION_LENGTH)}"} do %>
|
2017-03-10 23:21:43 +08:00
|
|
|
<% 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 %>
|
2017-01-06 22:58:23 +08:00
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<%= link_to download_asset_path(ff.object), data: {no_turbolink: true} do %>
|
2017-03-10 23:21:43 +08:00
|
|
|
<% 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 %>
|
2017-01-06 22:58:23 +08:00
|
|
|
<% end %>
|
2016-08-17 21:51:04 +08:00
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% else %>
|
2017-01-06 22:58:23 +08:00
|
|
|
<%= image_tag image_tag ff.object.url(:medium) if ff.object.is_image? %>
|
2016-08-17 21:51:04 +08:00
|
|
|
<p><%= ff.object.file_file_name %></p>
|
2016-02-12 23:52:43 +08:00
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<%= ff.file_field :file %>
|
2017-03-13 20:20:49 +08:00
|
|
|
<% end %>
|
2016-02-12 23:52:43 +08:00
|
|
|
</div>
|
2016-10-02 00:47:05 +08:00
|
|
|
</div>
|