<% 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)) %>

<% if protocol.in_repository? %>
  <span class="label label-info">
    <%= t('search.index.in_repository') %>
  </span>
  &nbsp;
<% end %>
<% if protocol.archived? %>
  <span class="label label-warning">
    <%= t('search.index.archived') %>
  </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) %>
<% else %>
  <%= text %>
<% end %>
