scinote-web/app/views/search/results/partials/_my_module_text.html.erb
ajugo 67dcbb0fa6
Open the correct experiment view [SCI-7662][SCI-7741] (#4798)
* Fix experiment view loading [SCI-7662]

* Fix experiment view loading [SCI-7662]
2023-01-12 11:31:04 +01:00

39 lines
1.6 KiB
Text

<% link_to_page = :protocols if local_assigns[:link_to_page].nil? %>
<% query ||= nil %>
<% text = query.present? ? highlight(my_module.name, query.strip.split(/\s+/)) : my_module.name %>
<% if my_module.archived? %>
<span class="label label-warning"><%=t 'search.index.archived' %></span>
<% if can_restore_my_module?(my_module) %>
<%= route_to_other_team my_modules_experiment_path(my_module.experiment, view_mode: :archived),
my_module.experiment.project.team,
text %>
<% else %>
<%= text %>
<% end %>
<% else %>
<% if can_read_experiment?(my_module.experiment) %>
<% case link_to_page %>
<% when :repositories %>
<%= route_to_other_team protocols_my_module_path(my_module),
my_module.experiment.project.team,
text %>
<% when :protocols %>
<%= route_to_other_team protocols_my_module_path(my_module),
my_module.experiment.project.team,
text %>
<% when :canvas %>
<%= route_to_other_team canvas_experiment_path(my_module.experiment),
my_module.experiment.project.team,
text %>
<% when :results %>
<%= route_to_other_team results_my_module_path(my_module),
my_module.experiment.project.team,
text %>
<% else %>
<%= text %>
<% end %>
<% else %>
<%= text %>
<% end %>
<% end %>