From 57175454796bd8828fe440638323a4ed89ab0ded Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Wed, 18 Sep 2024 13:36:26 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Handle=20blank=20query=20and=20s?= =?UTF-8?q?nippets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit will address blank catalog searches and how it interacts with snippets. Prior, when the user submitted a blank catalog search, the entire indexed text will be returned. This is not desired because if we're looking at a book with a hundred pages, then that's a lot of rendered text. Instead, if we don't have a query string then we will also return. --- app/helpers/iiif_print/iiif_print_helper_behavior.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/iiif_print/iiif_print_helper_behavior.rb b/app/helpers/iiif_print/iiif_print_helper_behavior.rb index 8fb08866..ce827c33 100644 --- a/app/helpers/iiif_print/iiif_print_helper_behavior.rb +++ b/app/helpers/iiif_print/iiif_print_helper_behavior.rb @@ -7,7 +7,7 @@ module IiifPrint::IiifPrintHelperBehavior # rubocop:disable Rails/OutputSafety def render_ocr_snippets(options = {}) snippets = options[:value] - return if snippets.blank? + return if snippets.blank? || params[:q].blank? snippets_content = [content_tag('div', "... #{snippets.first} ...".html_safe,