scinote-web/app/views/steps/_form_assets.html.erb

40 lines
1.7 KiB
Plaintext
Raw Normal View History

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">
<%= ff.remove_nested_fields_link do %>
<span class="glyphicon glyphicon-remove"></span>
<% end %>
</div>
</div>
<div class="panel-body">
<% if ff.object.file.exists? %>
<% if can_view_or_download_step_assets(@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 %>
<%= 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>
<% end %>
<% else %>
<%= link_to download_asset_path(ff.object), data: {no_turbolink: true} do %>
<%= image_tag ff.object.url(:medium) if ff.object.is_image? %>
<p><%= truncate(ff.object.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% end %>
<% end %>
2016-02-12 23:52:43 +08:00
<% else %>
<%= image_tag image_tag ff.object.url(:medium) if ff.object.is_image? %>
<p><%= ff.object.file_file_name %></p>
2016-02-12 23:52:43 +08:00
<% end %>
<% else %>
<%= ff.file_field :file %>
<% end %>
</div>
</div>