scinote-web/app/views/search/results/_checklists.html.erb
2021-02-09 13:07:40 +01:00

74 lines
2.5 KiB
Text

<% results.each do |checklist| %>
<h5>
<span class="fas fa-check-square"></span>
<%= highlight checklist.name, search_query.strip.split(/\s+/) %>
</h5>
<% if checklist.checklist_items.count > 0 %>
<div class="well well-sm well-search-checklist">
<ul class="list-unstyled">
<% checklist.checklist_items.each do |item| %>
<li>
<input type="checkbox" disabled="disabled">
<%= highlight item.text, search_query.strip.split(/\s+/) %>
</li>
<% end %>
</ul>
</div>
<% end %>
<p>
<span>
<%=t "search.index.created_at" %>
<%=l checklist.created_at, format: :full %>
</span>
<br>
<span>
<%=t "search.index.step" %>
<%= render partial: "search/results/partials/step_text.html.erb",
locals: { step: checklist.step, target: nil } %>
</span>
<br>
<% if checklist.step.protocol.in_module? %>
<span>
<%=t "search.index.module" %>
<%= render partial: "search/results/partials/my_module_text.html.erb",
locals: { my_module: checklist.step.protocol.my_module } %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb",
locals: { experiment: checklist.step.protocol.my_module.experiment } %>
</span>
<br>
<% if checklist.step.protocol.my_module.experiment.project.project_folder %>
<span>
<%=t "search.index.folder" %>
<%= render partial: "search/results/partials/project_folders_text.html.erb",
locals: { folder: checklist.step.protocol.my_module.experiment.project.project_folder } %>
</span>
<br>
<% end %>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: checklist.step.protocol.my_module.experiment.project, link_to_page: :show } %>
</span>
<% else %>
<span>
<%=t "search.index.protocol" %>
<%= render partial: "search/results/partials/protocol_text.html.erb",
locals: { protocol: checklist.step.protocol, query: search_query } %>
</span>
<% end %>
<br>
<span>
<%=t "search.index.team" %>
<%= render partial: "search/results/partials/team_text.html.erb",
locals: { team: checklist.step.protocol.team } %>
</span>
</p>
<hr>
<% end %>