Fix links on search page (#1867)

This commit is contained in:
aignatov-bio 2019-07-02 11:21:00 +02:00 committed by GitHub
parent 68ebf13bca
commit 378e91b426
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 28 deletions

View file

@ -378,7 +378,7 @@
}
function initCallBacks() {
applyCreateWopiFileCallback();
if (typeof(applyCreateWopiFileCallback) === 'function') applyCreateWopiFileCallback();
applyCheckboxCallBack();
applyStepCompletedCallBack();
applyEditCallBack();

View file

@ -1,5 +1,5 @@
<% provide(:head_title, t("search.index.head_title")) %>
<%= render partial: "protocols/index/protocol_preview_modal.html.erb" %>
<div class="content-pane">
<div class="page-header">
<h1><%= t('search.index.results_title_html', query: @display_query) %></h1>

View file

@ -32,30 +32,73 @@
<p>
<% if comment.is_a?(ProjectComment) && comment.project.present? %>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: comment.project, link_to_page: :root } %>
</span>
<% project = comment.project %>
<% elsif comment.is_a?(TaskComment) && comment.my_module.present? %>
<span>
<%=t "search.index.module" %>
<%= render partial: "search/results/partials/my_module_text.html.erb",
locals: { my_module: comment.my_module, link_to_page: :canvas } %>
</span>
<% my_module = comment.my_module %>
<% experiment = my_module.experiment %>
<% project = experiment.project %>
<% elsif comment.is_a?(StepComment) && comment.step.present? %>
<span>
<%=t "search.index.step" %>
<%= render partial: "search/results/partials/step_text.html.erb",
locals: { step: comment.step, target: :comment } %>
</span>
<% step = comment.step %>
<% my_module = step.protocol.my_module %>
<% experiment = my_module.experiment %>
<% project = experiment.project %>
<% elsif comment.is_a?(ResultComment) && comment.result.present? %>
<% result = comment.result %>
<% my_module = result.my_module %>
<% experiment = my_module.experiment %>
<% project = experiment.project %>
<% end %>
<% if result %>
<span>
<%=t "search.index.result" %>
<%= render partial: "search/results/partials/result_text.html.erb",
locals: { result: comment.result, target: :comment } %>
locals: { result: result, target: :comment } %>
</span>
<br>
<% end %>
<% if step %>
<span>
<%=t "search.index.step" %>
<%= render partial: "search/results/partials/step_text.html.erb",
locals: { step: step, target: :comment } %>
</span>
<br>
<% end %>
<% if my_module %>
<span>
<%=t "search.index.module" %>
<%= render partial: "search/results/partials/my_module_text.html.erb",
locals: { my_module: my_module, link_to_page: :canvas } %>
</span>
<br>
<% end %>
<% if experiment %>
<span>
<%=t "search.index.experiment" %>
<%= render partial: "search/results/partials/experiment_text.html.erb",
locals: { experiment: experiment } %>
</span>
<br>
<% end %>
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: project, link_to_page: :show } %>
</span>
<br>
<span>
<%=t "search.index.team" %>
<%= render partial: "search/results/partials/team_text.html.erb",
locals: { team: project.team } %>
</span>
</p>
<hr>

View file

@ -1,5 +1,3 @@
<%= render partial: "protocols/index/protocol_preview_modal.html.erb" %>
<% results.each do |protocol| %>
<% has_description = protocol.description.present? && !protocol.description.empty? %>
<% has_authors = protocol.authors.present? && !protocol.authors.empty? %>
@ -107,7 +105,7 @@
<span>
<%=t "search.index.project" %>
<%= render partial: "search/results/partials/project_text.html.erb",
locals: { project: protocol.my_module.experiment.project } %>
locals: { project: protocol.my_module.experiment.project, link_to_page: :show } %>
</span>
<br>
<% end %>
@ -122,11 +120,4 @@
<% end %>
<%= javascript_include_tag "handsontable.full.min" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>
<%= stylesheet_link_tag 'datatables' %>
<%= javascript_include_tag "protocols/index" %>
<%= javascript_include_tag "protocols/steps" %>

View file

@ -19,6 +19,15 @@
<% end %>
<% if can_read_protocol_in_module?(protocol) || can_read_protocol_in_repository?(protocol) %>
<%= link_to text, '#', 'data-action': 'protocol-preview', 'data-url': preview_protocol_path(protocol) %>
<%= javascript_include_tag "handsontable.full.min" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>
<%= stylesheet_link_tag 'datatables' %>
<%= javascript_include_tag "protocols/index" %>
<%= javascript_include_tag "protocols/steps" %>
<% else %>
<%= text %>
<% end %>