diff --git a/app/helpers/iiif_print/iiif_print_helper_behavior.rb b/app/helpers/iiif_print/iiif_print_helper_behavior.rb
new file mode 100644
index 00000000..54da2c7f
--- /dev/null
+++ b/app/helpers/iiif_print/iiif_print_helper_behavior.rb
@@ -0,0 +1,22 @@
+module IiifPrint::IiifPrintHelperBehavior
+ ##
+ # print the ocr snippets. if more than one, separate with
+ #
+ # @param options [Hash] options hash provided by Blacklight
+ # @return [String] snippets HTML to be rendered
+ # rubocop:disable Rails/OutputSafety
+ def render_ocr_snippets(options = {})
+# debugger
+ snippets = options[:value]
+ snippets_content = [content_tag('div',
+ "... #{snippets.first} ...".html_safe,
+ class: 'ocr_snippet first_snippet')]
+ if snippets.length > 1
+ snippets_content << render(partial: 'catalog/snippets_more',
+ locals: { snippets: snippets.drop(1),
+ options: options })
+ end
+ snippets_content.join("\n").html_safe
+ end
+ # rubocop:enable Rails/OutputSafety
+end
\ No newline at end of file
diff --git a/app/helpers/iiif_print_helper.rb b/app/helpers/iiif_print_helper.rb
index 1dd04716..3fc2609a 100644
--- a/app/helpers/iiif_print_helper.rb
+++ b/app/helpers/iiif_print_helper.rb
@@ -41,24 +41,4 @@ def highlight_matches(document, hl_fl, hl_tag)
end
hl_matches.uniq.sort.join(' ')
end
-
- ##
- # print the ocr snippets. if more than one, separate with
- #
- # @param options [Hash] options hash provided by Blacklight
- # @return [String] snippets HTML to be rendered
- # rubocop:disable Rails/OutputSafety
- def render_ocr_snippets(options = {})
- snippets = options[:value]
- snippets_content = [content_tag('div',
- "... #{snippets.first} ...".html_safe,
- class: 'ocr_snippet first_snippet')]
- if snippets.length > 1
- snippets_content << render(partial: 'catalog/snippets_more',
- locals: { snippets: snippets.drop(1),
- options: options })
- end
- snippets_content.join("\n").html_safe
- end
- # rubocop:enable Rails/OutputSafety
end
diff --git a/lib/generators/iiif_print/install_generator.rb b/lib/generators/iiif_print/install_generator.rb
index 031ad8c3..15b6739c 100644
--- a/lib/generators/iiif_print/install_generator.rb
+++ b/lib/generators/iiif_print/install_generator.rb
@@ -30,6 +30,10 @@ def inject_assets
generate 'iiif_print:assets'
end
+ def inject_helper
+ copy_file 'helpers/iiif_print_helper.rb'
+ end
+
# Blacklight IIIF Search generator has some linting that does not agree with CircleCI on Hyku
# ref https://github.com/boston-library/blacklight_iiif_search/blob/v1.0.0/lib/generators/blacklight_iiif_search/controller_generator.rb
# the follow two methods does a clean up to appease Rubocop
diff --git a/lib/generators/iiif_print/templates/helpers/iiif_print_helper.rb b/lib/generators/iiif_print/templates/helpers/iiif_print_helper.rb
new file mode 100644
index 00000000..0c1859cf
--- /dev/null
+++ b/lib/generators/iiif_print/templates/helpers/iiif_print_helper.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+module IiifPrintHelper
+ include IiifPrint::IiifPrintHelperBehavior
+end