Added file downloading to protocol preview in protocol repository. [SCI-878]

This commit is contained in:
Matej Zrimšek 2017-01-11 14:13:48 +01:00
parent 8d4b2d7373
commit 852dc2eb7e
2 changed files with 12 additions and 4 deletions

View file

@ -112,9 +112,17 @@
<ul class="list-unstyled">
<% assets.each do |asset| %>
<li>
<%= image_tag preview_asset_path(asset) if asset.is_image? %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% 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>
<% end %>
<% else %>
<%= image_tag preview_asset_path(asset) if asset.is_image? %>
<p><%= truncate(asset.file_file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></p>
<% end %>
</li>
<% end %>
</ul>
@ -122,7 +130,6 @@
<% end %>
<% unless step.checklists.blank? then %>
<hr>
<div class="col-xs-12">
<% step.checklists.each do |checklist| %>
<strong><%= checklist.name %></strong>

View file

@ -57,6 +57,7 @@
<% end %>
</div>
<% end %>
<% assets = ordered_assets(step) %>
<% unless assets.blank? then %>
<div class="col-xs-12">