Module: IiifPrint::IiifPrintHelperBehavior

Included in:
IiifPrintHelper
Defined in:
app/helpers/iiif_print/iiif_print_helper_behavior.rb

Instance Method Summary collapse

Instance Method Details

#render_ocr_snippets(options = {}) ⇒ String

print the ocr snippets. if more than one, separate with <br/>

rubocop:disable Rails/OutputSafety

Parameters:

  • options (Hash) (defaults to: {})

    options hash provided by Blacklight

Returns:

  • (String)

    snippets HTML to be rendered



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/iiif_print/iiif_print_helper_behavior.rb', line 8

def render_ocr_snippets(options = {})
  snippets = options[:value]
  return if snippets.blank?

  snippets_content = [('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