% results.each do |protocol| %> <% has_description = protocol.description.present? %> <% has_authors = protocol.authors.present? %> <% has_keywords = protocol.in_repository? && protocol.protocol_keywords.count > 0 %>
<%=t 'search.object_id' %>
<%= highlight protocol.code, @search_query.strip.split(/\s+/) %>
<% if has_description %>
<%= t('search.index.description') %>
<%= highlight custom_auto_link(protocol.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team), search_query.strip.split(/\s+/) %>
<% if has_authors || has_keywords %>
<% end %>
<% end %>
<% if has_authors %>
<%= t('search.index.authors') %>
<%= highlight protocol.authors, search_query.strip.split(/\s+/) %>
<% if has_keywords %>
<% end %>
<% end %>
<% if has_keywords %>
<%= t('search.index.keywords') %>
<% protocol.protocol_keywords.each_with_index do |kw, i| %>
<%= highlight kw.name, search_query.strip.split(/\s+/) %>
<% if i < protocol.protocol_keywords.count - 1 %>
,
<% end %>
<% end %>
<% end %>
<%= t('search.index.created_at') %>
<%=l protocol.created_at, format: :full %>
<% if protocol.in_repository? && protocol.linked_modules.present? %>
<% if protocol_linked_modules = protocol.linked_modules %>
<%= t('search.index.modules') %>
<% protocol_linked_modules.each_with_index do |mod, i| %>
<%= render partial: "search/results/partials/my_module_text",
locals: { my_module: mod } %>
<% if i != (protocol_linked_modules.size - 1) %>
,
<% end %>
<% end %>
<% end %>
<% if protocol_linked_experiments = protocol.linked_experiments(protocol_linked_modules) %>
<%= t('search.index.experiment') %>
<% protocol_linked_experiments.each_with_index do |exp, i| %>
<%= render partial: "search/results/partials/experiment_text",
locals: { experiment: exp } %>
<% if i != (protocol_linked_experiments.size - 1) %>
,
<% end %>
<% end %>
<% end %>
<% if protocol_linked_projects = protocol.linked_projects(protocol_linked_experiments) %>
<%= t('search.index.project') %>
<% protocol_linked_projects.each_with_index do |pro, i| %>
<%= render partial: "search/results/partials/project_text",
locals: { project: pro, link_to_page: :show } %>
<% if i != (protocol_linked_projects.size - 1) %>
,
<% end %>
<% end %>
<% end %>
<% end %>
<% if protocol.in_module? %>
<%= t('search.index.module') %>
<%= render partial: "search/results/partials/my_module_text",
locals: { my_module: protocol.my_module } %>
<%= t('search.index.experiment') %>
<%= render partial: "search/results/partials/experiment_text",
locals: { experiment: protocol.my_module.experiment } %>
<%= t('search.index.project') %>
<%= render partial: "search/results/partials/project_text",
locals: { project: protocol.my_module.experiment.project, link_to_page: :show } %>
<% end %>
<%= t('search.index.team') %>
<%= render partial: "search/results/partials/team_text",
locals: { team: protocol.team } %>