scinote-web/app/views/search/results/_samples.html.erb
2018-07-27 15:27:08 +02:00

70 lines
2.2 KiB
Text

<% results.each do |sample| %>
<h5>
<span class="fas fa-tint"></span>
<%=t "search.index.samples.sample" %>
<%= highlight sample.name, search_query.strip.split(/\s+/) %>
</h5>
<p>
<span>
<%=t "search.index.samples.sample_type" %>
<% if sample.sample_type.present? %>
<%= highlight sample.sample_type.name, search_query.strip.split(/\s+/) %>
<% else %>
<em><%=t "search.index.samples.no_sample_type" %></em>
<% end %>
</span>
<br>
<span>
<%=t "search.index.samples.sample_group" %>
<span class="fas fa-asterisk" style="<%= "color: #{sample.sample_group.color}" if sample.sample_group.present? %>"></span>
<% if sample.sample_group.present? %>
<%= highlight sample.sample_group.name, search_query.strip.split(/\s+/) %>
<% else %>
<em><%=t "search.index.samples.no_sample_group" %></em>
<% end %>
</span>
<br>
<span>
<%=t "search.index.samples.added_on" %>
<%=l sample.created_at, format: :full %>
</span>
<br>
<span>
<%=t "search.index.samples.added_by" %>
<%= highlight sample.user.full_name, search_query.strip.split(/\s+/) %>
</span>
<% sample.sample_custom_fields.each do |sample_custom_field| %>
<br>
<span>
<%=t "search.index.samples.custom_field", cf: sample_custom_field.custom_field.name %>
<%= highlight sample_custom_field.value, search_query.strip.split(/\s+/) %>
</span>
<% end %>
</p>
<p>
<span>
<%=t "search.index.modules" %>
<% if sample.my_modules.count > 0 %>
<% sample.my_modules.each_with_index do |mod, i| %>
<%= render partial: "search/results/partials/my_module_text.html.erb",
locals: { my_module: mod, link_to_page: :samples } %>
<% if i != sample.my_modules.count - 1 %>
,&nbsp;
<% end %>
<% end %>
<% else %>
<em><%=t "search.index.sample_no_modules" %></em>
<% end %>
</span>
<br>
<span>
<%=t "search.index.team" %>
<%= render partial: "search/results/partials/team_text.html.erb",
locals: { team: sample.team } %>
</span>
</p>
<hr>
<% end %>