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

40 lines
1.2 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? %>
<span class="label label-warning"><%=t "search.index.archived" %></span>
<% if can_view_experiment_archive(my_module.experiment) and can_restore_module(my_module) %>
<a href="<%= module_archive_experiment_url(my_module.experiment) %>">
2016-02-12 23:52:43 +08:00
<%= text %>
</a>
<% else %>
<%= text %>
<% end %>
<% else %>
<% if can_view_module(my_module) %>
2016-07-21 19:11:15 +08:00
<% case link_to_page %>
<% when :samples %>
<a href="<%= samples_my_module_path(my_module) %>">
<%= text %>
</a>
<% when :protocols %>
<a href="<%= protocols_my_module_path(my_module) %>">
<%= text %>
</a>
<% when :canvas %>
<a href="<%= canvas_experiment_path(my_module.experiment) %>">
2016-07-21 19:11:15 +08:00
<%= text %>
</a>
<% when :results %>
<a href="<%= results_my_module_path(my_module) %>">
2016-07-21 19:11:15 +08:00
<%= text %>
</a>
<% else %>
<%= text %>
<% end %>
2016-02-12 23:52:43 +08:00
<% else %>
<%= text %>
<% end %>
<% end %>