Skip to content

Commit

Permalink
Mapping language codes to names
Browse files Browse the repository at this point in the history
  • Loading branch information
escowles committed Dec 21, 2016
1 parent a7fed3d commit 2070da1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Rails/DynamicFindBy:
- 'app/controllers/exhibits_controller.rb'
- 'app/models/exhibit_proxy.rb'
- 'app/decorators/applies_title_from_slug.rb'
- 'app/values/manifest_metadata.rb'

RSpec/ExampleWording:
CustomTransform:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ gem 'sitemap_generator'
gem 'blacklight-gallery', '>= 0.3.0'
gem 'blacklight-oembed'
gem 'devise_invitable'
gem 'iso-639'
gem 'iiif-presentation'
gem 'omniauth-cas'
gem 'sneakers'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ GEM
activesupport (>= 3.2.18)
faraday (~> 0.9.0)
json
iso-639 (0.2.8)
jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
Expand Down Expand Up @@ -554,6 +555,7 @@ DEPENDENCIES
factory_girl_rails
friendly_id!
iiif-presentation
iso-639
jbuilder (~> 2.0)
jquery-rails
omniauth-cas
Expand Down
2 changes: 2 additions & 0 deletions app/values/manifest_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def process_values(input_hash)
values.map! do |value|
if value["@value"]
value["@value"]
elsif key == 'Language'
ISO_639.find_by_code(value).try(:english_name) || value
else
value
end
Expand Down
2 changes: 1 addition & 1 deletion config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defaults: &defaults

development:
<<: *defaults
all_collection_manifest_url: "http://localhost:3000/iiif/collections"
#all_collection_manifest_url: "http://localhost:3000/iiif/collections"

test:
<<: *defaults
Expand Down
1 change: 1 addition & 0 deletions spec/models/iiif_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
scanned_resource_doc = docs.find { |x| x["full_title_ssim"] == ["Christopher and his kind, 1929-1939"] }
expect(scanned_resource_doc["readonly_date-created_tesim"]).to eq ['1976-01-01T00:00:00Z']
expect(scanned_resource_doc["readonly_range-label_tesim"]).to eq nil
expect(scanned_resource_doc["readonly_language_tesim"]).to eq ["English"]
end
end
end
Expand Down

0 comments on commit 2070da1

Please sign in to comment.