2016-07-21 19:11:15 +08:00
|
|
|
<% results.each do |protocol| %>
|
2021-07-23 17:56:28 +08:00
|
|
|
<% has_description = protocol.description.present? %>
|
|
|
|
<% has_authors = protocol.authors.present? %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% has_keywords = protocol.in_repository? && protocol.protocol_keywords.count > 0 %>
|
|
|
|
|
|
|
|
<h5>
|
2018-05-22 22:55:58 +08:00
|
|
|
<span class="fas fa-edit"></span>
|
2016-07-21 19:11:15 +08:00
|
|
|
<%= render partial: "search/results/partials/protocol_text.html.erb", locals: { protocol: protocol, query: search_query } %>
|
|
|
|
</h5>
|
|
|
|
|
|
|
|
<% if has_description || has_authors || has_keywords %>
|
|
|
|
<p>
|
|
|
|
<% if has_description %>
|
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.description') %>
|
2019-07-25 20:27:53 +08:00
|
|
|
<%= highlight custom_auto_link(protocol.tinymce_render(:description),
|
|
|
|
simple_format: false,
|
|
|
|
tags: %w(img),
|
|
|
|
team: current_team), search_query.strip.split(/\s+/) %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</span>
|
|
|
|
<% if has_authors || has_keywords %>
|
|
|
|
<br>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if has_authors %>
|
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.authors') %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<%= highlight protocol.authors, search_query.strip.split(/\s+/) %>
|
|
|
|
</span>
|
|
|
|
<% if has_keywords %>
|
|
|
|
<br>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if has_keywords %>
|
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.keywords') %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% 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 %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
</p>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.created_at') %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<%=l protocol.created_at, format: :full %>
|
|
|
|
</span>
|
|
|
|
<br>
|
2023-03-17 17:43:50 +08:00
|
|
|
<% if protocol.in_repository? && protocol.linked_modules.present? %>
|
2016-09-02 17:45:54 +08:00
|
|
|
<span>
|
2016-09-05 16:58:37 +08:00
|
|
|
<% if protocol_linked_modules = protocol.linked_modules %>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.modules') %>
|
2016-09-05 16:58:37 +08:00
|
|
|
<% protocol_linked_modules.each_with_index do |mod, i| %>
|
2016-09-02 17:45:54 +08:00
|
|
|
<%= render partial: "search/results/partials/my_module_text.html.erb",
|
|
|
|
locals: { my_module: mod } %>
|
2023-03-17 17:43:50 +08:00
|
|
|
<% if i != (protocol_linked_modules.size - 1) %>
|
2016-09-02 17:45:54 +08:00
|
|
|
,
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<span>
|
2016-09-05 16:58:37 +08:00
|
|
|
<% if protocol_linked_experiments = protocol.linked_experiments(protocol_linked_modules) %>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.experiment') %>
|
2016-09-05 16:58:37 +08:00
|
|
|
<% protocol_linked_experiments.each_with_index do |exp, i| %>
|
2016-09-02 17:45:54 +08:00
|
|
|
<%= render partial: "search/results/partials/experiment_text.html.erb",
|
|
|
|
locals: { experiment: exp } %>
|
2023-03-17 17:43:50 +08:00
|
|
|
<% if i != (protocol_linked_experiments.size - 1) %>
|
2016-09-02 17:45:54 +08:00
|
|
|
,
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<span>
|
2016-09-05 16:58:37 +08:00
|
|
|
<% if protocol_linked_projects = protocol.linked_projects(protocol_linked_experiments) %>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.project') %>
|
2016-09-05 16:58:37 +08:00
|
|
|
<% protocol_linked_projects.each_with_index do |pro, i| %>
|
2016-09-02 17:45:54 +08:00
|
|
|
<%= render partial: "search/results/partials/project_text.html.erb",
|
2016-09-05 17:40:49 +08:00
|
|
|
locals: { project: pro, link_to_page: :show } %>
|
2023-03-17 17:43:50 +08:00
|
|
|
<% if i != (protocol_linked_projects.size - 1) %>
|
2016-09-02 17:45:54 +08:00
|
|
|
,
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
<br>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% if protocol.in_module? %>
|
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.module') %>
|
2016-07-26 18:59:37 +08:00
|
|
|
<%= render partial: "search/results/partials/my_module_text.html.erb",
|
|
|
|
locals: { my_module: protocol.my_module } %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</span>
|
|
|
|
<br>
|
2016-07-26 18:12:43 +08:00
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.experiment') %>
|
2016-07-26 18:59:37 +08:00
|
|
|
<%= render partial: "search/results/partials/experiment_text.html.erb",
|
|
|
|
locals: { experiment: protocol.my_module.experiment } %>
|
2016-07-26 18:12:43 +08:00
|
|
|
</span>
|
|
|
|
<br>
|
2016-07-21 19:11:15 +08:00
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.project') %>
|
2016-07-26 18:59:37 +08:00
|
|
|
<%= render partial: "search/results/partials/project_text.html.erb",
|
2019-07-02 17:21:00 +08:00
|
|
|
locals: { project: protocol.my_module.experiment.project, link_to_page: :show } %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</span>
|
|
|
|
<br>
|
|
|
|
<% end %>
|
|
|
|
<span>
|
2023-03-17 17:43:50 +08:00
|
|
|
<%= t('search.index.team') %>
|
2017-01-25 19:01:23 +08:00
|
|
|
<%= render partial: "search/results/partials/team_text.html.erb",
|
|
|
|
locals: { team: protocol.team } %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
<% end %>
|