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

141 lines
4.8 KiB
Text
Raw Normal View History

2017-01-06 01:08:59 +08:00
<%= render partial: "protocols/index/protocol_preview_modal.html.erb" %>
2016-07-21 19:11:15 +08:00
<% results.each do |protocol| %>
<% has_description = protocol.description.present? && !protocol.description.empty? %>
<% has_authors = protocol.authors.present? && !protocol.authors.empty? %>
<% has_keywords = protocol.in_repository? && protocol.protocol_keywords.count > 0 %>
<h5>
<span class="glyphicon glyphicon-list-alt"></span>
<%= 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>
<%=t "search.index.description" %>
<%= highlight protocol.description, search_query.strip.split(/\s+/) %>
</span>
<% if has_authors || has_keywords %>
<br>
<% end %>
<% end %>
<% if has_authors %>
<span>
<%=t "search.index.authors" %>
<%= highlight protocol.authors, search_query.strip.split(/\s+/) %>
</span>
<% if has_keywords %>
<br>
<% end %>
<% end %>
<% if has_keywords %>
<span>
<%=t "search.index.keywords" %>
<% protocol.protocol_keywords.each_with_index do |kw, i| %>
<%= highlight kw.name, search_query.strip.split(/\s+/) %>
<% if i < protocol.protocol_keywords.count - 1 %>
,&nbsp;
<% end %>
<% end %>
</span>
<% end %>
</p>
<% end %>
<p>
<span>
<%=t "search.index.created_at" %>
<%=l protocol.created_at, format: :full %>
</span>
<br>
<% if protocol.nr_of_linked_children > 0 %>
<span>
2016-09-05 16:58:37 +08:00
<% if protocol_linked_modules = protocol.linked_modules %>
<%=t "search.index.modules" %>
2016-09-05 16:58:37 +08:00
<% protocol_linked_modules.each_with_index do |mod, i| %>
<%= render partial: "search/results/partials/my_module_text.html.erb",
locals: { my_module: mod } %>
2016-09-05 16:58:37 +08:00
<% if i != (protocol_linked_modules.count - 1) %>
,&nbsp;
<% end %>
<% end %>
<% end %>
</span>
<br>
<span>
2016-09-05 16:58:37 +08:00
<% if protocol_linked_experiments = protocol.linked_experiments(protocol_linked_modules) %>
<%=t "search.index.experiment" %>
2016-09-05 16:58:37 +08:00
<% protocol_linked_experiments.each_with_index do |exp, i| %>
<%= render partial: "search/results/partials/experiment_text.html.erb",
locals: { experiment: exp } %>
2016-09-05 16:58:37 +08:00
<% if i != (protocol_linked_experiments.count - 1) %>
,&nbsp;
<% end %>
<% end %>
<% end %>
</span>
<br>
<span>
2016-09-05 16:58:37 +08:00
<% if protocol_linked_projects = protocol.linked_projects(protocol_linked_experiments) %>
<%=t "search.index.project" %>
2016-09-05 16:58:37 +08:00
<% protocol_linked_projects.each_with_index do |pro, i| %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: pro, link_to_page: :show } %>
2016-09-05 16:58:37 +08:00
<% if i != (protocol_linked_projects.count - 1) %>
,&nbsp;
<% end %>
<% end %>
<% end %>
</span>
<% end %>
<br>
2016-07-21 19:11:15 +08:00
<% if protocol.in_module? %>
<span>
<%=t "search.index.module" %>
<%= 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>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb",
locals: { experiment: protocol.my_module.experiment } %>
</span>
<br>
2016-07-21 19:11:15 +08:00
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: protocol.my_module.experiment.project } %>
2016-07-21 19:11:15 +08:00
</span>
<br>
<% end %>
<span>
2017-01-25 19:01:23 +08:00
<%=t "search.index.team" %>
<%= 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 %>
2017-01-06 01:08:59 +08:00
<%= stylesheet_link_tag 'datatables' %>
<%= javascript_include_tag "protocols/index" %>
<%= javascript_include_tag "protocols/steps" %>
<!-- Libraries for formulas -->
<%= javascript_include_tag "lodash" %>
<%= javascript_include_tag "numeral" %>
<%= javascript_include_tag "numeric" %>
<%= javascript_include_tag "md5" %>
<%= javascript_include_tag "jstat" %>
<%= javascript_include_tag "formula" %>
<%= javascript_include_tag "parser" %>
<%= javascript_include_tag "ruleJS" %>
<%= javascript_include_tag "handsontable.formula" %>
<%= javascript_include_tag "big.min" %>
<%= stylesheet_link_tag "handsontable.formula" %>