scinote-web/app/views/search/results/partials/_protocol_text.html.erb
2021-07-23 11:56:28 +02:00

33 lines
1.1 KiB
Text

<% query ||= nil %>
<% text = query.present? ? highlight(protocol.name, query.strip.split(/\s+/)) : (protocol.name.blank? ? t("search.index.no_name") : protocol.name) %>
<% if protocol.in_repository_public? %>
<span class="label label-info">
<%=t "search.index.public" %>
</span>
&nbsp;
<% elsif protocol.in_repository_private? %>
<span class="label label-info">
<%=t "search.index.private" %>
</span>
&nbsp;
<% elsif protocol.in_repository_archived? %>
<span class="label label-warning">
<%=t "search.index.archived" %>
</span>
&nbsp;
<% end %>
<% if can_read_protocol_in_module?(protocol) || can_read_protocol_in_repository?(protocol) %>
<%= link_to text, '#', 'data-action': 'protocol-preview', 'data-url': preview_protocol_path(protocol) %>
<%= javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>
<%= stylesheet_link_tag 'datatables' %>
<%= javascript_include_tag "protocols/index" %>
<%= javascript_include_tag "protocols/steps" %>
<% else %>
<%= text %>
<% end %>