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

70 lines
2.2 KiB
Text
Raw Normal View History

2016-02-12 23:52:43 +08:00
<% results.each do |sample| %>
<h5>
<span class="glyphicon glyphicon-tint"></span>
<%=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="glyphicon glyphicon-asterisk" style="<%= "color: #{sample.sample_group.color}" if sample.sample_group.present? %>"></span>
<% 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>
<%=t "search.index.organization" %>
<%= render partial: "search/results/partials/organization_text.html.erb", locals: { organization: sample.organization } %>
</span>
</p>
<hr>
<% end %>