Add experiment text to all searches related to experiment

This commit is contained in:
Jure Grabnar 2016-07-26 12:12:43 +02:00
parent 690ad0fffa
commit 80621c9b6b
12 changed files with 72 additions and 7 deletions

View file

@ -59,9 +59,14 @@
<%= render partial: "search/results/partials/my_module_text.html.erb", locals: { my_module: asset.result.my_module } %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb", locals: { experiment: asset.result.my_module.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: asset.result.my_module.project } %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: asset.result.my_module.experiment.project } %>
</span>
<br>
<span>

View file

@ -34,6 +34,11 @@
<%= 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_modul.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: checklist.step.protocol.my_module.project } %>

View file

@ -1,7 +1,8 @@
<% results.each do |experiment| %>
<h5>
<span class="glyphicon glyphicon-filter"></span>
<%= highlight experiment.name, search_query.strip.split(/\s+/) %>
<%= render partial: "search/results/partials/experiment_text.html.erb",
locals: { experiment: experiment, query: search_query } %>
</h5>
<p>

View file

@ -19,14 +19,19 @@
<%=l mod.created_at, format: :full %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb", locals: { experiment: mod.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: mod.project } %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: mod.experiment.project } %>
</span>
<br>
<span>
<%=t "search.index.organization" %>
<%= render partial: "search/results/partials/organization_text.html.erb", locals: { organization: mod.project.organization } %>
<%= render partial: "search/results/partials/organization_text.html.erb", locals: { organization: mod.experiment.project.organization } %>
</span>
</p>

View file

@ -54,6 +54,11 @@
<%= render partial: "search/results/partials/my_module_text.html.erb", locals: { my_module: protocol.my_module } %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb", locals: { experiment: protocol.my_module.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: protocol.my_module.project } %>

View file

@ -34,9 +34,14 @@
<%= render partial: "search/results/partials/my_module_text.html.erb", locals: { my_module: result.my_module } %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb", locals: { experiment: result.my_module.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: result.my_module.project } %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: result.my_module.experiment.project } %>
</span>
<br>
<span>

View file

@ -26,6 +26,11 @@
locals: { my_module: step.protocol.my_module, link_to_page: :protocols } %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb", locals: { experiment: step.protocol.my_module.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: step.protocol.my_module.project } %>

View file

@ -23,9 +23,14 @@
locals: { my_module: table.step.protocol.my_module, link_to_page: :results } %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb", locals: { experiment: table.step.protocol.my_module.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: table.step.protocol.my_module.project } %>
<%= render partial: "search/results/partials/project_text.html.erb", locals: { project: table.step.protocol.my_module.experiment.project } %>
</span>
<% else %>
<span>

View file

@ -10,10 +10,15 @@
<%=l workflow.created_at, format: :full %>
</span>
<br>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb", locals: { experiment: workflow.protocol.my_module.experiment } %>
</span>
<br>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: workflow.project, link_to_page: :canvas } %>
locals: { project: workflow.experiment.project, link_to_page: :canvas } %>
</span>
<br>
<span>

View file

@ -0,0 +1,21 @@
<% query ||= nil %>
<% text = query.present? ? highlight(experiment.name, query.strip.split(/\s+/)) : experiment.name %>
<% if experiment.archived? %>
<span class="label label-warning"><%=t "search.index.archived" %></span>
<% if can_view_experiment(experiment) and can_restore_experiment(experiment.project) %>
<a href="/">
<%= text %>
</a>
<% else %>
<%= text %>
<% end %>
<% else %>
<% if can_view_experiment(experiment) %>
<a href="<%= experiment_path(experiment) %>">
<%= text %>
</a>
<% else %>
<%= text %>
<% end %>
<% end %>

View file

@ -109,6 +109,7 @@ en:
no_description: "No description"
organization: "Team: "
project: "Project: "
experiment: "Experiment: "
protocol: "Protocol: "
modules: "Tasks: "
tag_no_modules: "not added to any tasks"

View file

@ -106,6 +106,8 @@ Rails.application.routes.draw do
get 'users/edit', to: 'user_projects#index_edit'
end
resources :experiments, only: [:show]
# Show action is a popup (JSON) for individual module in full-zoom canvas,
# as well as "module info" page for single module (HTML)
resources :my_modules, path: "/modules", only: [:show, :edit, :update, :destroy] do