mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-08 07:21:03 +08:00
Update global search to use new step text elements [SCI-6873] (#4165)
This commit is contained in:
parent
803f65e689
commit
a7e88e59bd
3 changed files with 15 additions and 11 deletions
|
|
@ -60,8 +60,9 @@ class Step < ApplicationRecord
|
||||||
.pluck(:id)
|
.pluck(:id)
|
||||||
|
|
||||||
new_query = Step.distinct
|
new_query = Step.distinct
|
||||||
|
.left_outer_joins(:step_texts)
|
||||||
.where(steps: { protocol_id: protocol_ids })
|
.where(steps: { protocol_id: protocol_ids })
|
||||||
.where_attributes_like(%i(name description), query, options)
|
.where_attributes_like(['name', 'step_texts.text'], query, options)
|
||||||
|
|
||||||
# Show all results if needed
|
# Show all results if needed
|
||||||
if page == Constants::SEARCH_NO_LIMIT
|
if page == Constants::SEARCH_NO_LIMIT
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,18 @@
|
||||||
<%= render partial: "search/results/partials/step_text.html.erb", locals: { step: step, query: search_query, target: nil } %>
|
<%= render partial: "search/results/partials/step_text.html.erb", locals: { step: step, query: search_query, target: nil } %>
|
||||||
</h5>
|
</h5>
|
||||||
|
|
||||||
<% if step.description.present? %>
|
<% if step.step_texts.present? %>
|
||||||
<p>
|
<% step.step_texts.each do |step_text| %>
|
||||||
<span>
|
<p>
|
||||||
<%=t "search.index.description" %>
|
<span>
|
||||||
<%= highlight custom_auto_link(step.tinymce_render(:description),
|
<%= t('search.index.text') %>
|
||||||
simple_format: false,
|
<%= highlight custom_auto_link(step_text.tinymce_render(:text),
|
||||||
tags: %w(img),
|
simple_format: false,
|
||||||
team: current_team), search_query.strip.split(/\s+/) %>
|
tags: %w(img),
|
||||||
</span>
|
team: current_team), search_query.strip.split(/\s+/) %>
|
||||||
<p>
|
</span>
|
||||||
|
<p>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -311,6 +311,7 @@ en:
|
||||||
authors: "Authors: "
|
authors: "Authors: "
|
||||||
description: "Description: "
|
description: "Description: "
|
||||||
no_description: "No description"
|
no_description: "No description"
|
||||||
|
text: "Text"
|
||||||
team: "Team: "
|
team: "Team: "
|
||||||
folder: "Folders: "
|
folder: "Folders: "
|
||||||
repository: "Inventory: "
|
repository: "Inventory: "
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue