From 8ac7ccbea7a264e8c0c605bec781983de1d2df8f Mon Sep 17 00:00:00 2001 From: Cory Lown Date: Thu, 24 Oct 2024 09:41:45 -0400 Subject: [PATCH 1/2] Update Spotlight to v4.3 --- Gemfile | 2 +- Gemfile.lock | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 7f6aba46c..181b1e2c7 100644 --- a/Gemfile +++ b/Gemfile @@ -93,7 +93,7 @@ gem 'blacklight', '~> 7.34' gem 'blacklight-gallery', '~> 4.4' gem 'blacklight_heatmaps' gem 'blacklight-hierarchy' -gem 'blacklight-spotlight', '~> 4.0' +gem 'blacklight-spotlight', '~> 4.3' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' gem 'blacklight_advanced_search' gem 'blacklight_range_limit', '~> 8.0' diff --git a/Gemfile.lock b/Gemfile.lock index cff82b931..a30ae34ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -122,7 +122,7 @@ GEM blacklight (>= 7.25, < 9) rails ruby-oembed - blacklight-spotlight (4.2.0) + blacklight-spotlight (4.3.0) activejob-status acts-as-taggable-on (>= 5.0, < 12) autoprefixer-rails @@ -272,7 +272,7 @@ GEM actionmailer (>= 5.0) devise (>= 4.6) diff-lcs (1.5.1) - diffy (3.4.2) + diffy (3.4.3) dlss-capistrano (5.2.0) bcrypt_pbkdf capistrano (~> 3.0) @@ -331,7 +331,7 @@ GEM mime-types (>= 1.0) friendly_id (5.5.1) activerecord (>= 4.0.0) - gapic-common (0.22.0) + gapic-common (0.23.0) faraday (>= 1.9, < 3.a) faraday-retry (>= 1.0, < 3.a) google-protobuf (>= 3.25, < 5.a) @@ -356,22 +356,22 @@ GEM google-cloud-env (2.2.1) faraday (>= 1.0, < 3.a) google-cloud-errors (1.4.0) - google-protobuf (4.28.2) + google-protobuf (4.28.3) bigdecimal rake (>= 13) - google-protobuf (4.28.2-aarch64-linux) + google-protobuf (4.28.3-aarch64-linux) bigdecimal rake (>= 13) - google-protobuf (4.28.2-arm64-darwin) + google-protobuf (4.28.3-arm64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.28.2-x86-linux) + google-protobuf (4.28.3-x86-linux) bigdecimal rake (>= 13) - google-protobuf (4.28.2-x86_64-darwin) + google-protobuf (4.28.3-x86_64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.28.2-x86_64-linux) + google-protobuf (4.28.3-x86_64-linux) bigdecimal rake (>= 13) googleapis-common-protos (1.6.0) @@ -380,7 +380,7 @@ GEM grpc (~> 1.41) googleapis-common-protos-types (1.16.0) google-protobuf (>= 3.18, < 5.a) - googleauth (1.11.1) + googleauth (1.11.2) faraday (>= 1.0, < 3.a) google-cloud-env (~> 2.1) jwt (>= 1.4, < 3.0) @@ -910,7 +910,7 @@ DEPENDENCIES blacklight-gallery (~> 4.4) blacklight-hierarchy blacklight-oembed (~> 1.0) - blacklight-spotlight (~> 4.0) + blacklight-spotlight (~> 4.3) blacklight_advanced_search blacklight_heatmaps blacklight_range_limit (~> 8.0) From 73f6e6e070bb9ca4a49b394f25554b54cf62dc7c Mon Sep 17 00:00:00 2001 From: Cory Lown Date: Thu, 24 Oct 2024 09:42:01 -0400 Subject: [PATCH 2/2] Customize alt text instructions link --- .../javascripts/sir_trevor_block_overrides.js | 5 +++++ spec/features/alt_text_instructions_spec.rb | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 spec/features/alt_text_instructions_spec.rb diff --git a/app/assets/javascripts/sir_trevor_block_overrides.js b/app/assets/javascripts/sir_trevor_block_overrides.js index 91ed9e212..de264c4e3 100644 --- a/app/assets/javascripts/sir_trevor_block_overrides.js +++ b/app/assets/javascripts/sir_trevor_block_overrides.js @@ -15,3 +15,8 @@ if (navigator.userAgentData && navigator.userAgentData.brands && Boolean(navigator.userAgentData.brands.find(function(b) { return b.brand === 'Chromium' && parseFloat(b.version, 10) >= 95 && parseFloat(b.version, 10) < 97; }))) { SirTrevor.Blocks.Text.prototype.editorHTML = "
"; } + +// Override the alt text link url so it goes to Stanford's guidelines +SirTrevor.Locales.en.blocks.alt_text_guidelines = $.extend(SirTrevor.Locales.en.blocks.alt_text_guidelines, { + link_url: 'https://uit.stanford.edu/accessibility/concepts/images' +}); diff --git a/spec/features/alt_text_instructions_spec.rb b/spec/features/alt_text_instructions_spec.rb new file mode 100644 index 000000000..dbf028056 --- /dev/null +++ b/spec/features/alt_text_instructions_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'Alt text instructions', :js do + include JavascriptFeatureHelpers + + let(:exhibit) { create(:exhibit) } + let(:exhibit_curator) { create(:exhibit_curator, exhibit: exhibit) } + + before do + login_as exhibit_curator + visit spotlight.edit_exhibit_home_page_path(exhibit) + add_widget 'uploaded_items' + end + + it 'displays alternative text guidelines with the customized link' do + expect(page).to have_content('For each item, please enter alternative text') + expect(page).to have_link('Guidelines for writing alt text.', href: 'https://uit.stanford.edu/accessibility/concepts/images') + end +end