From dc26ae16baba1a178941e8c4928f185c6716fa2a Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Fri, 30 Jun 2023 14:23:11 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Move=20render=5Focr=5Fsnippets?= =?UTF-8?q?=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref #469 & https://github.com/scientist-softserv/iiif_print/pull/254 * Update IiifPrint to use a branch that: - does not include derivative rodeo, which broke PDF splitting - moves render_ocr_snippets method to an appropriate helpers * Remove render_ocr_snippets definition from application controller. * Add iiif_print_helper to pull in behavior. --- Gemfile.lock | 2 +- app/controllers/application_controller.rb | 21 +-------------------- app/helpers/iiif_print_helper.rb | 4 ++++ 3 files changed, 6 insertions(+), 21 deletions(-) create mode 100644 app/helpers/iiif_print_helper.rb diff --git a/Gemfile.lock b/Gemfile.lock index dca88b20..8e47db47 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,7 +27,7 @@ GIT GIT remote: https://github.com/scientist-softserv/iiif_print.git - revision: d44ea621b0751d11f054d4ae30b994ea5454c591 + revision: 9f20467a6ff1f14872087f1e1dddda0f9fea91fd branch: no-rodeo specs: iiif_print (1.0.0) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2a0ba85a..7955352e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,7 +2,6 @@ class ApplicationController < ActionController::Base include HykuHelper - include IiifPrintHelper # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception, prepend: true @@ -20,7 +19,7 @@ class ApplicationController < ActionController::Base include Hyrax::ThemedLayoutController with_themed_layout '1_column' - helper_method :current_account, :admin_host?, :render_ocr_snippets + helper_method :current_account, :admin_host? before_action :authenticate_if_needed before_action :require_active_account!, if: :multitenant? before_action :set_account_specific_connections! @@ -33,24 +32,6 @@ class ApplicationController < ActionController::Base protected - # remove this once we've backported to `IIIFPrintHelper` and update IIIF Print - def render_ocr_snippets(options = {}) - snippets = options[:value] - # rubocop:disable Rails/OutputSafety - snippets_content = [ActionController::Base.helpers.content_tag('div', - "... #{snippets.first} ...".html_safe, - class: 'ocr_snippet first_snippet')] - # rubocop:enable Rails/OutputSafety - if snippets.length > 1 - snippets_content << render(partial: 'catalog/snippets_more', - locals: { snippets: snippets.drop(1), - options: options }) - end - # rubocop:disable Rails/OutputSafety - snippets_content.join("\n").html_safe - # rubocop:enable Rails/OutputSafety - end - def is_hidden current_account.persisted? && !current_account.is_public? end diff --git a/app/helpers/iiif_print_helper.rb b/app/helpers/iiif_print_helper.rb new file mode 100644 index 00000000..56f80324 --- /dev/null +++ b/app/helpers/iiif_print_helper.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true +module IiifPrintHelper + include IiifPrint::IiifPrintHelperBehavior +end \ No newline at end of file