diff --git a/app/models/step.rb b/app/models/step.rb index bd3290ec6..99586340f 100644 --- a/app/models/step.rb +++ b/app/models/step.rb @@ -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 diff --git a/app/views/search/results/_steps.html.erb b/app/views/search/results/_steps.html.erb index fab45cbdf..c3e6a5b8a 100644 --- a/app/views/search/results/_steps.html.erb +++ b/app/views/search/results/_steps.html.erb @@ -4,16 +4,18 @@ <%= render partial: "search/results/partials/step_text.html.erb", locals: { step: step, query: search_query, target: nil } %> - <% if step.description.present? %> -
- - <%=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+/) %> - -
+ <% if step.step_texts.present? %> + <% step.step_texts.each do |step_text| %> +
+ + <%= 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+/) %> + +
+ <% end %> <% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 2dc2aca06..c40e179a7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -311,6 +311,7 @@ en: authors: "Authors: " description: "Description: " no_description: "No description" + text: "Text" team: "Team: " folder: "Folders: " repository: "Inventory: "