Merge pull request #448 from okriuchykhin/ok_SCI_945

Fix openning of protocol preview with images [SCI-945]
This commit is contained in:
okriuchykhin 2017-01-25 17:27:01 +01:00 committed by GitHub
commit 648d256dff

View file

@ -113,13 +113,24 @@
<% assets.each do |asset| %>
<li>
<% if can_view_or_download_step_assets(@protocol) %>
<%= link_to download_asset_path(asset), data: {no_turbolink: true, id: true, status: "asset-present"} do %>
<%= image_tag preview_asset_path(asset) if asset.is_image? %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% if asset.is_image? %>
<%= link_to download_asset_path(asset),
class: 'image-preview-link',
id: "modal_link#{asset.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 asset.url(:medium), data: {'preview-url': large_image_url_asset_path(asset)} %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% end %>
<% else %>
<%= link_to download_asset_path(asset), data: {no_turbolink: true} do %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% end %>
<% end %>
<% else %>
<%= image_tag preview_asset_path(asset) if asset.is_image? %>
<%= image_tag asset.url(:medium) if asset.is_image? %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% end %>