-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref: https://github.com/scientist-softserv/adventist-dl/issues/469 Method `render_ocr_snippets` was causing AbstractController::DoubleRenderError () during random situations, due to including the IiifPrintHelper in ApplicationController. This pull request moves it into a helper module which is injected by the install generator, which matches how it was done in LV & NNP. See https://github.com/scientist-softserv/louisville-hyku/blob/b672d2a3213aaee84c082eb8083d8ad70733036b/app/helpers/newspaper_works_helper.rb#L3
- Loading branch information
Showing
4 changed files
with
31 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module IiifPrint::IiifPrintHelperBehavior | ||
## | ||
# print the ocr snippets. if more than one, separate with <br/> | ||
# | ||
# @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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
lib/generators/iiif_print/templates/helpers/iiif_print_helper.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module IiifPrintHelper | ||
include IiifPrint::IiifPrintHelperBehavior | ||
end |