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) .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

View file

@ -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>

View file

@ -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: "