1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
5 <%# The locators in the given text are expected to be of the form JSON_KEEP_LOCATOR_REGEXP %>
7 <% data_height = data_height || 100 %>
8 <div style="max-height:<%=data_height%>px; overflow:auto;">
9 <% text_data.each_line do |line| %>
10 <% matches = keep_locator_in_json line %>
12 <% if matches.nil? or matches.empty? %>
13 <span style="white-space: pre-wrap; margin: none;"><%= line %></span>
16 matches.uniq.each do |loc|
17 pdh, filename = loc.split('/', 2)
19 if object_readable(pdh)
21 replacement = link_to_arvados_object_if_readable(pdh, pdh, friendly_name: true)
23 link_params = {controller: 'collections', action: 'show_file', uuid: pdh, file: filename}
24 if preview_allowed_for(filename)
25 params = {disposition: 'inline'}
27 params = {disposition: 'attachment'}
29 file_link = link_to(raw("/"+filename), link_params.merge(params))
31 replacement << file_link
33 # Add link(s) substitution
34 subs << [loc, replacement]
37 # Replace all readable locators with links
38 subs.each do |loc, link|
41 <span style="white-space: pre-wrap; margin: none;"><%= raw line %></span>