scinote-web/app/views/search/results/_samples.html.erb

71 lines
2.2 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% results.each do |sample| %>
<h5>
<span class="fas fa-tint"></span>
2016-02-12 23:52:43 +08:00
<%=t "search.index.samples.sample" %>
2016-07-21 19:11:15 +08:00
<%= highlight sample.name, search_query.strip.split(/\s+/) %>
2016-02-12 23:52:43 +08:00
</h5>
<p>
<span>
<%=t "search.index.samples.sample_type" %>
<% if sample.sample_type.present? %>
2016-07-21 19:11:15 +08:00
<%= highlight sample.sample_type.name, search_query.strip.split(/\s+/) %>
2016-02-12 23:52:43 +08:00
<% 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>
2016-02-12 23:52:43 +08:00
<% if sample.sample_group.present? %>
2016-07-21 19:11:15 +08:00
<%= highlight sample.sample_group.name, search_query.strip.split(/\s+/) %>
2016-02-12 23:52:43 +08:00
<% 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" %>
2016-07-21 19:11:15 +08:00
<%= highlight sample.user.full_name, search_query.strip.split(/\s+/) %>
2016-02-12 23:52:43 +08:00
</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 %>
2016-07-21 19:11:15 +08:00
<%= highlight sample_custom_field.value, search_query.strip.split(/\s+/) %>
2016-02-12 23:52:43 +08:00
</span>
<% end %>
</p>
<p>
<span>
<%=t "search.index.modules" %>
<% if sample.my_modules.count > 0 %>
<% sample.my_modules.each_with_index do |mod, i| %>
2016-07-21 19:11:15 +08:00
<%= render partial: "search/results/partials/my_module_text.html.erb",
locals: { my_module: mod, link_to_page: :samples } %>
2016-02-12 23:52:43 +08:00
<% if i != sample.my_modules.count - 1 %>
,&nbsp;
<% end %>
<% end %>
<% else %>
<em><%=t "search.index.sample_no_modules" %></em>
<% end %>
</span>
<br>
<span>
2017-01-25 19:01:23 +08:00
<%=t "search.index.team" %>
<%= render partial: "search/results/partials/team_text.html.erb",
locals: { team: sample.team } %>
2016-02-12 23:52:43 +08:00
</span>
</p>
<hr>
<% end %>