2021-09-30 17:32:11 +08:00
|
|
|
<%
|
2019-10-01 20:20:20 +08:00
|
|
|
query ||= nil
|
|
|
|
asset_read_allowed = false
|
|
|
|
file_name = asset.blob.metadata["asset_type"] ? asset.blob.metadata["name"] : asset.file_name
|
|
|
|
text = query.present? ? highlight(file_name, query.strip.split(/\s+/)) : file_name
|
|
|
|
%>
|
2016-02-12 23:52:43 +08:00
|
|
|
|
2017-12-06 02:51:44 +08:00
|
|
|
<% if asset.step %>
|
|
|
|
<% protocol = asset.step.protocol %>
|
2018-02-02 01:41:28 +08:00
|
|
|
<% if can_read_protocol_in_module?(protocol) ||
|
2018-03-26 19:19:09 +08:00
|
|
|
can_read_protocol_in_repository?(protocol) %>
|
|
|
|
<% asset_read_allowed = true %>
|
2019-08-07 19:29:04 +08:00
|
|
|
<a href="<%= rails_blob_path(asset.file, disposition: 'attachment') %>">
|
2017-12-06 02:51:44 +08:00
|
|
|
<%= text %>
|
|
|
|
</a>
|
2018-03-26 19:19:09 +08:00
|
|
|
<% else %>
|
|
|
|
<%= text %>
|
|
|
|
<% end %>
|
|
|
|
<% elsif asset.result %>
|
|
|
|
<% if can_read_experiment?(asset.result.my_module.experiment) %>
|
|
|
|
<% asset_read_allowed = true %>
|
2019-08-07 19:29:04 +08:00
|
|
|
<a href="<%= rails_blob_path(asset.file, disposition: 'attachment') %>">
|
2018-03-26 19:19:09 +08:00
|
|
|
<%= text %>
|
|
|
|
</a>
|
|
|
|
<% else %>
|
|
|
|
<%= text %>
|
|
|
|
<% end %>
|
|
|
|
<% elsif asset.repository_asset_value %>
|
2019-07-17 22:00:49 +08:00
|
|
|
<% if can_read_repository?(asset.repository_asset_value.repository_cell.repository_row.repository) %>
|
2018-03-26 19:19:09 +08:00
|
|
|
<% asset_read_allowed = true %>
|
2019-08-07 19:29:04 +08:00
|
|
|
<a href="<%= rails_blob_path(asset.file, disposition: 'attachment') %>">
|
2018-03-26 19:19:09 +08:00
|
|
|
<%= text %>
|
|
|
|
</a>
|
|
|
|
<% else %>
|
|
|
|
<%= text %>
|
2017-12-06 02:51:44 +08:00
|
|
|
<% end %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% else %>
|
|
|
|
<%= text %>
|
2016-10-11 22:16:48 +08:00
|
|
|
<% end %>
|
2018-03-26 19:19:09 +08:00
|
|
|
|
|
|
|
<!-- Display asset contents if it exists -->
|
|
|
|
<% if asset_read_allowed && asset.headline.present? && asset.headline.include?("<mark>") %>
|
|
|
|
<blockquote class="blockquote-search">
|
|
|
|
<p><%= highlight(sanitize_input(asset.headline), query.strip.split(/\s+/)) %></p>
|
|
|
|
</blockquote>
|
|
|
|
<% end %>
|