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

44 lines
1.8 KiB
Plaintext
Raw Normal View History

2016-07-21 19:11:15 +08:00
<% link_to_page = :protocols if local_assigns[:link_to_page].nil? %>
2016-02-12 23:52:43 +08:00
<% query ||= nil %>
2016-07-21 19:11:15 +08:00
<% text = query.present? ? highlight(my_module.name, query.strip.split(/\s+/)) : my_module.name %>
2016-02-12 23:52:43 +08:00
<% if my_module.archived? %>
2017-01-25 19:01:23 +08:00
<span class="label label-warning"><%=t 'search.index.archived' %></span>
<% if can_read_experiment?(my_module.experiment) && can_restore_module(my_module) %>
2017-01-25 19:01:23 +08:00
<%= route_to_other_team module_archive_experiment_url(my_module.experiment),
my_module.experiment.project.team,
text %>
2016-02-12 23:52:43 +08:00
<% else %>
<%= text %>
<% end %>
<% else %>
<% if can_read_experiment?(my_module.experiment) %>
2016-07-21 19:11:15 +08:00
<% case link_to_page %>
<% when :samples %>
2017-01-25 19:01:23 +08:00
<%= route_to_other_team samples_my_module_path(my_module),
my_module.experiment.project.team,
text %>
<% when :repositories %>
<%= route_to_other_team repository_my_module_path(my_module, repository),
my_module.experiment.project.team,
text %>
2016-07-21 19:11:15 +08:00
<% when :protocols %>
2017-01-25 19:01:23 +08:00
<%= route_to_other_team protocols_my_module_path(my_module),
my_module.experiment.project.team,
text %>
2016-07-21 19:11:15 +08:00
<% when :canvas %>
2017-01-25 19:01:23 +08:00
<%= route_to_other_team canvas_experiment_path(my_module.experiment),
my_module.experiment.project.team,
text %>
2016-07-21 19:11:15 +08:00
<% when :results %>
2017-01-25 19:01:23 +08:00
<%= route_to_other_team results_my_module_path(my_module),
my_module.experiment.project.team,
text %>
2016-07-21 19:11:15 +08:00
<% else %>
<%= text %>
<% end %>
2016-02-12 23:52:43 +08:00
<% else %>
<%= text %>
<% end %>
<% end %>