scinote-web/app/views/search/results/partials/_asset_text.html.erb

16 lines
514 B
Plaintext

<% query ||= nil %>
<% text = query.present? ? highlight(asset.file_file_name, query.strip.split(/\s+/)) : asset.file_file_name %>
<% if asset.step %>
<% protocol = asset.step.protocol %>
<% if can_read_protocol_in_module?(protocol) ||
can_read_protocol_in_repository?(protocol) ||
(asset.result && can_read_experiment?(protocol.my_module.experiment)) %>
<a href="<%= download_asset_path asset %>" target="_blank">
<%= text %>
</a>
<% end %>
<% else %>
<%= text %>
<% end %>