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

40 lines
1.6 KiB
Text
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_restore_my_module?(my_module) %>
<%= route_to_other_team my_modules_experiment_path(my_module.experiment, view_mode: :archived),
2017-01-25 19:01:23 +08:00
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 :repositories %>
<%= 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 :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 %>
<%= route_to_other_team my_module_results_path(my_module),
2017-01-25 19:01:23 +08:00
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 %>