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

23 lines
773 B
Text
Raw Normal View History

2016-07-21 19:11:15 +08:00
<% query ||= nil %>
<% text = query.present? ? highlight(escape_input(protocol.name), query.strip.split(/\s+/)) : (protocol.name.blank? ? t('search.index.no_name') : escape_input(protocol.name)) %>
2016-07-21 19:11:15 +08:00
<% if protocol.in_repository? %>
2017-01-06 01:08:59 +08:00
<span class="label label-info">
<%= t('search.index.in_repository') %>
2017-01-06 01:08:59 +08:00
</span>
&nbsp;
<% end %>
<% if protocol.archived? %>
2017-01-06 01:08:59 +08:00
<span class="label label-warning">
<%= t('search.index.archived') %>
2017-01-06 01:08:59 +08:00
</span>
&nbsp;
<% end %>
<% if protocol.in_module? && can_read_protocol_in_module?(protocol) %>
<%= link_to text, protocols_my_module_path(protocol.my_module) %>
<% elsif protocol.in_repository? && can_read_protocol_in_repository?(protocol) %>
<%= link_to text, protocol_path(protocol) %>
2016-07-21 19:11:15 +08:00
<% else %>
2017-01-06 01:08:59 +08:00
<%= text %>
2016-07-21 19:11:15 +08:00
<% end %>