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

22 lines
754 B
Plaintext
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% query ||= nil %>
2016-07-21 19:11:15 +08:00
<% text = query.present? ? highlight(asset.file_file_name, query.strip.split(/\s+/)) : asset.file_file_name %>
2016-02-12 23:52:43 +08:00
<% if asset.step %>
<% protocol = asset.step.protocol %>
<% if protocol.in_module? && can_view_or_download_step_assets(protocol) %>
<a href="<%= download_asset_path asset %>" target="_blank">
<%= text %>
</a>
<% elsif protocol.in_repository? && can_read_protocol_in_repository?(protocol) %>
<a href="<%= download_asset_path asset %>" target="_blank">
<%= text %>
</a>
<% end %>
2016-07-21 19:11:15 +08:00
<% elsif asset.result and can_view_or_download_result_assets(asset.result.my_module) %>
<a href="<%= download_asset_path asset %>" target="_blank">
2016-02-12 23:52:43 +08:00
<%= text %>
2016-07-21 19:11:15 +08:00
</a>
<% else %>
<%= text %>
2016-10-11 22:16:48 +08:00
<% end %>