Skip to content

Commit

Permalink
Merge pull request #2614 from sul-dlss/2583-alt-text
Browse files Browse the repository at this point in the history
Customize alt text instructions link; update spotlight to v4.3
  • Loading branch information
taylor-steve authored Oct 24, 2024
2 parents 7eb4578 + 73f6e6e commit 1079cfc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
22 changes: 11 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions app/assets/javascripts/sir_trevor_block_overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<div class=\"st-text-block\" spellcheck=\"false\" contenteditable=\"true\"></div>";
}

// 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'
});
21 changes: 21 additions & 0 deletions spec/features/alt_text_instructions_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1079cfc

Please sign in to comment.