From ad5eb6de10016d2583bd1b7ca23630bf267b65a1 Mon Sep 17 00:00:00 2001 From: dnoneill Date: Tue, 17 Dec 2024 13:48:47 -0500 Subject: [PATCH] settings for stage testing --- app/assets/javascripts/request_viewer_state.js | 10 +++++----- app/assets/javascripts/select_image_area.js | 8 +++++--- app/components/custom_viewer_component.rb | 6 +++++- app/helpers/application_helper.rb | 4 ++-- config/initializers/oembed.rb | 4 +++- config/settings.yml | 2 +- db/development.sqlite3-shm | Bin 32768 -> 0 bytes db/development.sqlite3-wal | 0 .../catalog/_embedded_mirador3.html.erb_spec.rb | 13 ++++++++++--- 9 files changed, 31 insertions(+), 16 deletions(-) delete mode 100644 db/development.sqlite3-shm delete mode 100644 db/development.sqlite3-wal diff --git a/app/assets/javascripts/request_viewer_state.js b/app/assets/javascripts/request_viewer_state.js index 05ad7c489..8ad27a674 100644 --- a/app/assets/javascripts/request_viewer_state.js +++ b/app/assets/javascripts/request_viewer_state.js @@ -12,11 +12,11 @@ }, setupRequestButton: function() { - $('#request-state').on('click', (event) => { - this.formId = event.target.dataset.formId; - this.itemId = event.target.dataset.itemId; - this.requestState(); - }); + document.querySelector('#request-state').addEventListener('click', (event) => { + this.formId = event.target.dataset.formId; + this.itemId = event.target.dataset.itemId; + this.requestState(); + }); }, setupIframeMessageListener: function() { diff --git a/app/assets/javascripts/select_image_area.js b/app/assets/javascripts/select_image_area.js index 50677ca17..2920dfa9f 100644 --- a/app/assets/javascripts/select_image_area.js +++ b/app/assets/javascripts/select_image_area.js @@ -18,7 +18,8 @@ const exhibit_path = this.panel.closest('form')[0].dataset.exhibitPath; const iiif_initial_viewer_config = $(`input[name="item[${itemId}][iiif_initial_viewer_config]"]`, this.panel)[0].value; const canvas_id = $(`input[name="item[${itemId}][iiif_canvas_id]"]`, this.panel)[0].value; - let href = `${exhibit_path}/select_image_area/${resourceId}?form_id=${this.panel[0].id}&item_id=${itemId}&canvas_id=${canvas_id}` + let href = `${exhibit_path}/select_image_area/${resourceId}?form_id=${this.panel[0].id}&item_id=${itemId}` + if (canvas_id != "undefined") href += `&canvas_id=${canvas_id}` if (iiif_initial_viewer_config && iiif_initial_viewer_config != "undefined") href += `&iiif_initial_viewer_config=${encodeURIComponent(iiif_initial_viewer_config)}` const selectImageAreaHtml = $(`Select image area`); const image_url = this.panel[0].querySelector('img'); @@ -46,14 +47,15 @@ Blacklight.onLoad(function () { if (mutation.type === 'childList') { mutation.addedNodes.forEach(node => { if (node.nodeType === 1 && node.tagName === 'LI') { - SelectImageArea.init(node); + const isEmbed = node.closest('[data-type]').dataset.type == 'solr_documents_embed'; + if (isEmbed) SelectImageArea.init(node); } }); } } }; - document.querySelectorAll('[data-type="solr_documents_embed"]').forEach(function(element, i) { + document.querySelectorAll('#page-content').forEach(function(element, i) { const observer = new MutationObserver(callback); observer.observe(element, {childList: true, subtree: true}); }) diff --git a/app/components/custom_viewer_component.rb b/app/components/custom_viewer_component.rb index efdbfc458..22b9eb49e 100644 --- a/app/components/custom_viewer_component.rb +++ b/app/components/custom_viewer_component.rb @@ -11,6 +11,10 @@ def initialize(document:, presenter:, view_config: nil, block_context: nil, **kw @document = document @presenter = presenter @view_config = view_config - @block_context = block_context + @block_context = correct_block(block_context) + end + + def correct_block(block_context) + block_context&.item&.select { |_key, value| value['id'] == @document.id } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0ab0e58ba..c35f6fa7d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -68,11 +68,11 @@ def custom_render_oembed_tag_async(document, canvas_id, block) # @param [SirTrevorRails::Blocks::SolrDocumentsEmbedBlock] block # @return [String] Selected canvas URI def choose_canvas_id(sir_trevor_block) - sir_trevor_block&.items&.dig(0, 'iiif_canvas_id') if sir_trevor_block.respond_to? :items + sir_trevor_block&.values&.dig(0, 'iiif_canvas_id') end def choose_initial_viewer_config(sir_trevor_block) - sir_trevor_block&.items&.dig(0, 'iiif_initial_viewer_config') if sir_trevor_block.respond_to? :items + sir_trevor_block&.values&.dig(0, 'iiif_initial_viewer_config') end def context_specific_oembed_url(document) diff --git a/config/initializers/oembed.rb b/config/initializers/oembed.rb index 64e97df4e..1e2a7f001 100644 --- a/config/initializers/oembed.rb +++ b/config/initializers/oembed.rb @@ -2,9 +2,11 @@ OEmbed::Providers.register_all -purl_provider = OEmbed::Provider.new('http://purl.stanford.edu/embed.{format}?&hide_title=true') +#purl_provider = OEmbed::Provider.new('http://purl.stanford.edu/embed.{format}?&hide_title=true') +purl_provider = OEmbed::Provider.new('https://purl.stanford.edu/embed.{format}?&hide_title=true') purl_provider << 'http://purl.stanford.edu/*' purl_provider << 'https://purl.stanford.edu/*' +#purl_provider << 'https://sul-purl-stage.stanford.edu/*' purl_provider << 'http://searchworks.stanford.edu/*' purl_uat_provider = OEmbed::Provider.new('https://sul-purl-uat.stanford.edu/embed.{format}?&hide_title=true') diff --git a/config/settings.yml b/config/settings.yml index 3e61fb8c1..09ad584bd 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -30,7 +30,7 @@ feature_flags: traject: processing_thread_pool: 1 iiif_embed: - url: https://embed.stanford.edu/iiif + url: https://embed-stage.stanford.edu/iiif iiif_dnd_base_url: https://library.stanford.edu/iiif?%{query} action_mailer: default_options: diff --git a/db/development.sqlite3-shm b/db/development.sqlite3-shm deleted file mode 100644 index fe9ac2845eca6fe6da8a63cd096d9cf9e24ece10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeIuAr62r3