Update global search to use new step text elements [SCI-6873] (#4165)

This commit is contained in:
Alex Kriuchykhin 2022-07-06 14:20:55 +02:00 committed by GitHub
parent 803f65e689
commit a7e88e59bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 11 deletions

View file

@ -60,8 +60,9 @@ class Step < ApplicationRecord
.pluck(:id)
new_query = Step.distinct
.left_outer_joins(:step_texts)
.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
if page == Constants::SEARCH_NO_LIMIT

View file

@ -4,16 +4,18 @@
<%= render partial: "search/results/partials/step_text.html.erb", locals: { step: step, query: search_query, target: nil } %>
</h5>
<% if step.description.present? %>
<p>
<span>
<%=t "search.index.description" %>
<%= highlight custom_auto_link(step.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team), search_query.strip.split(/\s+/) %>
</span>
<p>
<% if step.step_texts.present? %>
<% step.step_texts.each do |step_text| %>
<p>
<span>
<%= t('search.index.text') %>
<%= highlight custom_auto_link(step_text.tinymce_render(:text),
simple_format: false,
tags: %w(img),
team: current_team), search_query.strip.split(/\s+/) %>
</span>
<p>
<% end %>
<% end %>
<p>

View file

@ -311,6 +311,7 @@ en:
authors: "Authors: "
description: "Description: "
no_description: "No description"
text: "Text"
team: "Team: "
folder: "Folders: "
repository: "Inventory: "