blacklight-spotlight 0.32.0 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/app/assets/images/spotlight/default_browse_thumbnail.jpg +0 -0
  4. data/app/assets/javascripts/spotlight/application.js +6 -1
  5. data/app/assets/javascripts/spotlight/blocks/pages_block.js +1 -1
  6. data/app/assets/javascripts/spotlight/blocks/resources_block.js +7 -4
  7. data/app/assets/javascripts/spotlight/blocks/solr_documents_base_block.js +108 -0
  8. data/app/assets/javascripts/spotlight/blocks/solr_documents_block.js +12 -56
  9. data/app/assets/javascripts/spotlight/blocks/solr_documents_carousel_block.js +3 -3
  10. data/app/assets/javascripts/spotlight/blocks/solr_documents_embed_block.js +3 -3
  11. data/app/assets/javascripts/spotlight/blocks/solr_documents_features_block.js +3 -3
  12. data/app/assets/javascripts/spotlight/blocks/solr_documents_grid_block.js +3 -3
  13. data/app/assets/javascripts/spotlight/crop.es6 +205 -0
  14. data/app/assets/javascripts/spotlight/croppable.js +7 -104
  15. data/app/assets/javascripts/spotlight/iiif.es6 +54 -0
  16. data/app/assets/javascripts/spotlight/multi_image_selector.js +34 -16
  17. data/app/assets/javascripts/spotlight/pages.js.erb +1 -1
  18. data/app/assets/javascripts/spotlight/reindex_monitor.js +5 -1
  19. data/app/assets/javascripts/spotlight/search_typeahead.js +33 -47
  20. data/app/assets/javascripts/spotlight/sir-trevor/locales.js +5 -2
  21. data/app/assets/javascripts/spotlight/zpr_links.js.erb +30 -0
  22. data/app/assets/stylesheets/spotlight/_croppable.scss +8 -13
  23. data/app/assets/stylesheets/spotlight/_multi_image_selector.scss +1 -1
  24. data/app/assets/stylesheets/spotlight/_pages.scss +5 -0
  25. data/app/assets/stylesheets/spotlight/typeahead.css +0 -1
  26. data/app/controllers/concerns/spotlight/base.rb +3 -5
  27. data/app/controllers/spotlight/appearances_controller.rb +6 -4
  28. data/app/controllers/spotlight/catalog_controller.rb +10 -0
  29. data/app/controllers/spotlight/contacts_controller.rb +2 -6
  30. data/app/controllers/spotlight/featured_images_controller.rb +26 -0
  31. data/app/controllers/spotlight/pages_controller.rb +3 -2
  32. data/app/controllers/spotlight/resources/iiif_harvester_controller.rb +10 -0
  33. data/app/controllers/spotlight/resources/upload_controller.rb +4 -3
  34. data/app/controllers/spotlight/searches_controller.rb +20 -6
  35. data/app/controllers/spotlight/sites_controller.rb +2 -5
  36. data/app/helpers/spotlight/application_helper.rb +14 -1
  37. data/app/helpers/spotlight/crop_helper.rb +37 -0
  38. data/app/helpers/spotlight/main_app_helpers.rb +13 -0
  39. data/app/helpers/spotlight/meta_helper.rb +10 -20
  40. data/app/models/concerns/spotlight/solr_document.rb +1 -2
  41. data/app/models/concerns/spotlight/solr_document/uploaded_resource.rb +1 -23
  42. data/app/models/sir_trevor_rails/blocks/browse_block.rb +10 -0
  43. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +10 -0
  44. data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +5 -0
  45. data/app/models/spotlight/analytics/ga.rb +1 -1
  46. data/app/models/spotlight/blacklight_configuration.rb +16 -8
  47. data/app/models/spotlight/contact.rb +2 -13
  48. data/app/models/spotlight/contact_image.rb +11 -0
  49. data/app/models/spotlight/exhibit.rb +11 -8
  50. data/app/models/spotlight/exhibit_thumbnail.rb +12 -0
  51. data/app/models/spotlight/feature_page.rb +3 -5
  52. data/app/models/spotlight/featured_image.rb +28 -9
  53. data/app/models/spotlight/home_page.rb +2 -0
  54. data/app/models/spotlight/masthead.rb +5 -11
  55. data/app/models/spotlight/page.rb +5 -0
  56. data/app/models/spotlight/reindex_progress.rb +10 -18
  57. data/app/models/spotlight/reindexing_log_entry.rb +1 -0
  58. data/app/models/spotlight/resources/iiif_harvester.rb +33 -0
  59. data/app/models/spotlight/resources/iiif_manifest.rb +211 -0
  60. data/app/models/spotlight/resources/iiif_service.rb +93 -0
  61. data/app/models/spotlight/resources/upload.rb +1 -2
  62. data/app/models/spotlight/search.rb +5 -34
  63. data/app/presenters/spotlight/iiif_manifest_presenter.rb +79 -0
  64. data/app/serializers/spotlight/exhibit_export_serializer.rb +9 -41
  65. data/app/services/spotlight/carrierwave_file_resolver.rb +3 -1
  66. data/app/services/spotlight/iiif_resource_resolver.rb +73 -0
  67. data/app/services/spotlight/resources/iiif_builder.rb +17 -0
  68. data/app/services/spotlight/upload_solr_document_builder.rb +23 -23
  69. data/app/uploaders/spotlight/attachment_uploader.rb +0 -48
  70. data/app/uploaders/spotlight/featured_image_uploader.rb +2 -16
  71. data/app/views/_user_util_links.html.erb +8 -5
  72. data/app/views/catalog/_save_search.html.erb +4 -2
  73. data/app/views/layouts/spotlight/spotlight.html.erb +5 -1
  74. data/app/views/shared/_masthead.html.erb +1 -1
  75. data/app/views/spotlight/about_pages/_contact_properties.html.erb +1 -1
  76. data/app/views/spotlight/appearances/edit.html.erb +26 -6
  77. data/app/views/spotlight/browse/_search.html.erb +1 -1
  78. data/app/views/spotlight/contacts/_form.html.erb +12 -7
  79. data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +1 -1
  80. data/app/views/spotlight/exhibits/_exhibit_card_front.html.erb +2 -2
  81. data/app/views/spotlight/featured_images/_form.html.erb +12 -15
  82. data/app/views/spotlight/featured_images/_upload_form.html.erb +6 -12
  83. data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +3 -3
  84. data/app/views/spotlight/pages/_form.html.erb +3 -3
  85. data/app/views/spotlight/pages/edit.html.erb +4 -2
  86. data/app/views/spotlight/resources/iiif/_form.html.erb +9 -0
  87. data/app/views/spotlight/searches/_form.html.erb +3 -3
  88. data/app/views/spotlight/searches/_search.html.erb +4 -2
  89. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +2 -2
  90. data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +1 -1
  91. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +7 -2
  92. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +4 -2
  93. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +4 -2
  94. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +4 -2
  95. data/app/views/spotlight/sites/edit.html.erb +1 -1
  96. data/config/locales/spotlight.en.yml +31 -6
  97. data/config/routes.rb +9 -0
  98. data/db/migrate/20160714144125_add_iiif_urls_to_featured_image.rb +9 -0
  99. data/db/migrate/20160718194010_add_iiif_url_to_contact.rb +6 -0
  100. data/db/migrate/20160805143841_add_upload_id_to_resources.rb +6 -0
  101. data/db/migrate/20170204091234_add_theme_to_spotlight_exhibits.rb +5 -0
  102. data/lib/generators/spotlight/install_generator.rb +5 -2
  103. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +0 -1
  104. data/lib/generators/spotlight/templates/spotlight.scss +3 -2
  105. data/lib/migration/iiif.rb +82 -0
  106. data/lib/spotlight/engine.rb +22 -10
  107. data/lib/spotlight/version.rb +1 -1
  108. data/lib/tasks/spotlight_tasks.rake +10 -0
  109. data/spec/controllers/spotlight/about_pages_controller_spec.rb +1 -1
  110. data/spec/controllers/spotlight/appearances_controller_spec.rb +31 -18
  111. data/spec/controllers/spotlight/catalog_controller_spec.rb +40 -0
  112. data/spec/controllers/spotlight/contacts_controller_spec.rb +20 -1
  113. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +2 -6
  114. data/spec/controllers/spotlight/featured_images_controller_spec.rb +74 -0
  115. data/spec/controllers/spotlight/home_pages_controller_spec.rb +1 -1
  116. data/spec/controllers/spotlight/searches_controller_spec.rb +3 -1
  117. data/spec/controllers/spotlight/sites_controller_spec.rb +6 -1
  118. data/spec/examples.txt +1118 -1059
  119. data/spec/factories/contact_images.rb +6 -0
  120. data/spec/factories/contacts.rb +4 -1
  121. data/spec/factories/exhibit_thumbnails.rb +6 -0
  122. data/spec/factories/exhibits.rb +4 -0
  123. data/spec/factories/featured_images.rb +1 -0
  124. data/spec/factories/resources.rb +2 -1
  125. data/spec/features/add_contacts_spec.rb +5 -5
  126. data/spec/features/add_iiif_manifest_spec.rb +41 -0
  127. data/spec/features/add_items_spec.rb +2 -2
  128. data/spec/features/autocomplete_typeahead_spec.rb +86 -0
  129. data/spec/features/browse_category_admin_spec.rb +27 -6
  130. data/spec/features/browse_category_spec.rb +2 -2
  131. data/spec/features/create_exhibit_spec.rb +3 -3
  132. data/spec/features/exhibit_masthead_spec.rb +20 -9
  133. data/spec/features/exhibit_themes_spec.rb +25 -0
  134. data/spec/features/home_page_spec.rb +1 -1
  135. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +42 -0
  136. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +5 -3
  137. data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
  138. data/spec/features/javascript/multi_image_select_spec.rb +5 -6
  139. data/spec/features/javascript/search_config_admin_spec.rb +1 -1
  140. data/spec/features/site_masthead_spec.rb +14 -4
  141. data/spec/fixtures/gk446cj2442-manifest.json +58 -0
  142. data/spec/fixtures/iiif_responses.rb +274 -0
  143. data/spec/fixtures/sample_solr_documents.yml +106 -0
  144. data/spec/helpers/spotlight/crop_helper_spec.rb +9 -0
  145. data/spec/helpers/spotlight/main_app_helpers_spec.rb +45 -0
  146. data/spec/helpers/spotlight/meta_helper_spec.rb +2 -15
  147. data/spec/lib/migration/iiif_spec.rb +70 -0
  148. data/spec/models/spotlight/blacklight_configuration_spec.rb +17 -5
  149. data/spec/models/spotlight/contact_image_spec.rb +9 -0
  150. data/spec/models/spotlight/exhibit_spec.rb +17 -20
  151. data/spec/models/spotlight/exhibit_thumbnail_spec.rb +8 -0
  152. data/spec/models/spotlight/featured_image_spec.rb +59 -10
  153. data/spec/models/spotlight/masthead_spec.rb +33 -17
  154. data/spec/models/spotlight/page_spec.rb +14 -0
  155. data/spec/models/spotlight/reindex_progress_spec.rb +22 -73
  156. data/spec/models/spotlight/resources/iiif_harvester_spec.rb +30 -0
  157. data/spec/models/spotlight/resources/iiif_manifest_spec.rb +107 -0
  158. data/spec/models/spotlight/resources/iiif_service_spec.rb +52 -0
  159. data/spec/models/spotlight/resources/upload_spec.rb +7 -3
  160. data/spec/models/spotlight/search_spec.rb +0 -45
  161. data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +11 -29
  162. data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +123 -0
  163. data/spec/routing/spotlight/exhibit_catalog_spec.rb +4 -0
  164. data/spec/routing/spotlight/featured_images_spec.rb +21 -0
  165. data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +15 -18
  166. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +90 -0
  167. data/spec/spec_helper.rb +3 -0
  168. data/spec/support/features/test_features_helpers.rb +3 -2
  169. data/spec/support/stub_iiif_response.rb +24 -0
  170. data/spec/support/views/test_view_helpers.rb +1 -0
  171. data/spec/test_app_templates/Gemfile.extra +0 -1
  172. data/spec/uploaders/spotlight/attachment_uploader_spec.rb +24 -0
  173. data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +30 -0
  174. data/spec/views/_user_util_links.html.erb_spec.rb +9 -5
  175. data/spec/views/shared/_masthead.html.erb_spec.rb +5 -2
  176. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +2 -2
  177. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +4 -7
  178. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +7 -2
  179. data/spec/views/spotlight/pages/edit.html.erb_spec.rb +3 -1
  180. data/spec/views/spotlight/pages/new.html.erb_spec.rb +3 -1
  181. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +3 -2
  182. data/spec/views/spotlight/searches/edit.html.erb_spec.rb +3 -2
  183. data/vendor/assets/javascripts/leaflet-areaselect.js +184 -0
  184. data/vendor/assets/javascripts/leaflet-iiif.js +230 -0
  185. data/vendor/assets/javascripts/leaflet.js +9 -0
  186. data/vendor/assets/javascripts/polyfill.min.js +4 -0
  187. data/vendor/assets/stylesheets/leaflet-areaselect.css +15 -0
  188. data/vendor/assets/stylesheets/leaflet.css +624 -0
  189. metadata +136 -62
  190. data/app/assets/javascripts/spotlight/jcrop.js +0 -1696
  191. data/app/helpers/spotlight/jcrop_helper.rb +0 -37
  192. data/app/models/concerns/spotlight/default_thumbnailable.rb +0 -25
  193. data/app/models/concerns/spotlight/image_derivatives.rb +0 -58
  194. data/app/models/concerns/spotlight/solr_document/spotlight_images.rb +0 -55
  195. data/app/uploaders/spotlight/avatar_uploader.rb +0 -24
  196. data/app/uploaders/spotlight/item_uploader.rb +0 -25
  197. data/app/uploaders/spotlight/masthead_uploader.rb +0 -22
  198. data/spec/helpers/spotlight/jcrop_helper_spec.rb +0 -33
  199. data/spec/models/spotlight/default_thumbnailable_concern_spec.rb +0 -16
  200. data/spec/models/spotlight/image_derivatives_spec.rb +0 -15
  201. data/spec/models/spotlight/solr_document/spotlight_images_spec.rb +0 -42
  202. data/spec/uploaders/spotlight/item_uploader_spec.rb +0 -67
@@ -20,7 +20,7 @@ describe 'Home page', type: :feature do
20
20
  expect(page).to have_content('The home page was successfully updated.')
21
21
 
22
22
  within '.dropdown-menu' do
23
- click_link 'Dashboard'
23
+ click_link 'Exhibit dashboard'
24
24
  end
25
25
  click_link 'Feature pages'
26
26
  expect(page).to have_content 'New Home Page Title'
@@ -51,6 +51,36 @@ feature 'Solr Document Block', feature: true do
51
51
  expect(page).to have_selector '.items-block .box', count: 2
52
52
  end
53
53
 
54
+ scenario 'it should allow you to choose from a multi-image solr document (and persist through edits)', js: true do
55
+ fill_in_typeahead_field with: 'xd327cm9378'
56
+
57
+ expect(page).to have_css('[data-panel-image-pagination]', text: /Image 1 of 2/, visible: true)
58
+
59
+ # Select the last image
60
+ click_link('Change')
61
+ all('.thumbs-list li').last.click
62
+
63
+ save_page
64
+
65
+ # The thumbnail on the rendered block should be correct
66
+ thumb = find('.thumbnail img')
67
+ expect(thumb['src']).to match(%r{xd327cm9378_05_0002/full})
68
+
69
+ # revisit the edit page
70
+ visit spotlight.edit_exhibit_feature_page_path(exhibit, feature_page)
71
+
72
+ # Expect the image on the rendered edit screen to be correct
73
+ expect(page).to have_css('[data-panel-image-pagination]', text: /Image 2 of 2/, visible: true)
74
+ thumb = find('.pic.thumbnail img')
75
+ expect(thumb['src']).to match(%r{xd327cm9378_05_0002/full})
76
+
77
+ save_page
78
+
79
+ # Expect that the original image selection was retained
80
+ thumb = find('.thumbnail img')
81
+ expect(thumb['src']).to match(%r{xd327cm9378_05_0002/full})
82
+ end
83
+
54
84
  scenario 'it should allow you toggle visibility of solr documents', js: true do
55
85
  fill_in_typeahead_field with: 'dq287tq6352'
56
86
 
@@ -98,6 +128,18 @@ feature 'Solr Document Block', feature: true do
98
128
  end
99
129
  end
100
130
 
131
+ scenario 'should allow you to optionally display a ZPR link with the image', js: true do
132
+ fill_in_typeahead_field with: 'gk446cj2442'
133
+
134
+ check 'zpr_link'
135
+
136
+ save_page
137
+
138
+ expect(page).to have_selector('.zpr-link[data-iiif-tilesource]')
139
+ click_on 'Show in ZPR viewer'
140
+ expect(page).to have_css('#osd-modal-container')
141
+ end
142
+
101
143
  scenario 'should allow you to add text to the image', js: true do
102
144
  # fill in the content-editable div
103
145
  content_editable = find('.st-text-block')
@@ -48,9 +48,11 @@ feature 'Uploaded Items Block', feature: true, js: true do
48
48
  attach_file('uploaded_item_url', fixture_file1)
49
49
  attach_file('uploaded_item_url', fixture_file2)
50
50
 
51
- within('.panel') do
52
- uncheck 'Display?'
53
- end
51
+ # This line blocks until the javascript has added the file to the page:
52
+ expect(find('#st-block-3_display-checkbox_2')).to be_present
53
+
54
+ # Uncheck the first checkbox
55
+ all('input[type="checkbox"]').first.click
54
56
 
55
57
  save_page
56
58
 
@@ -95,7 +95,7 @@ feature 'Feature Pages Adminstration', js: true do
95
95
  # ensure page title not changed
96
96
  click_link exhibit_curator.email
97
97
  within '#user-util-collapse .dropdown' do
98
- click_link 'Dashboard'
98
+ click_link 'Exhibit dashboard'
99
99
  end
100
100
  click_link 'Feature pages'
101
101
  within("[data-id='#{page1.id}']") do
@@ -7,7 +7,7 @@ describe 'Multi image selector', type: :feature, js: true do
7
7
  it 'allows the user to select which image in a multi image object to display' do
8
8
  visit spotlight.edit_exhibit_feature_page_path(exhibit, feature_page)
9
9
 
10
- add_widget 'solr_documents'
10
+ add_widget 'solr_documents' # the "Item Row" widget
11
11
 
12
12
  fill_in_typeahead_field with: 'xd327cm9378'
13
13
 
@@ -21,10 +21,9 @@ describe 'Multi image selector', type: :feature, js: true do
21
21
  save_page
22
22
 
23
23
  visit spotlight.exhibit_feature_page_path(exhibit, feature_page)
24
-
25
24
  expect(page).to have_css("[data-id='xd327cm9378']")
26
- expect(page).to have_css("img[src='https://stacks.stanford.edu/image/xd327cm9378/xd327cm9378_05_0001_thumb']")
27
- expect(page).to_not have_css("img[src='https://stacks.stanford.edu/image/xd327cm9378/xd327cm9378_05_0002_thumb']")
25
+ expect(page).to have_css("img[src='https://stacks.stanford.edu/image/iiif/xd327cm9378%2Fxd327cm9378_05_0001/full/!400,400/0/default.jpg']")
26
+ expect(page).to_not have_css("img[src='https://stacks.stanford.edu/image/iiif/xd327cm9378%2Fxd327cm9378_05_0002/full/!400,400/0/default.jpg']")
28
27
 
29
28
  click_link('Edit')
30
29
 
@@ -42,7 +41,7 @@ describe 'Multi image selector', type: :feature, js: true do
42
41
  save_page
43
42
 
44
43
  expect(page).to have_css("[data-id='xd327cm9378']")
45
- expect(page).to_not have_css("img[src='https://stacks.stanford.edu/image/xd327cm9378/xd327cm9378_05_0001_thumb']")
46
- expect(page).to have_css("img[src='https://stacks.stanford.edu/image/xd327cm9378/xd327cm9378_05_0002_thumb']")
44
+ expect(page).to_not have_css("img[src='https://stacks.stanford.edu/image/iiif/xd327cm9378%2Fxd327cm9378_05_0001/full/!400,400/0/default.jpg']")
45
+ expect(page).to have_css("img[src='https://stacks.stanford.edu/image/iiif/xd327cm9378%2Fxd327cm9378_05_0002/full/!400,400/0/default.jpg']")
47
46
  end
48
47
  end
@@ -10,7 +10,7 @@ feature 'Search Configuration Administration', js: true do
10
10
 
11
11
  click_link user.email
12
12
  within '#user-util-collapse .dropdown' do
13
- click_link 'Dashboard'
13
+ click_link 'Exhibit dashboard'
14
14
  end
15
15
  click_link 'Search'
16
16
  click_link 'Options'
@@ -10,7 +10,10 @@ describe 'Add and update the site masthead', type: :feature do
10
10
 
11
11
  within '#site-masthead' do
12
12
  check 'Show background image in masthead'
13
- attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
13
+ # attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
14
+ # The JS fills in these fields:
15
+ find('#site_masthead_attributes_iiif_tilesource', visible: false).set 'http://test.host/images/7'
16
+ find('#site_masthead_attributes_iiif_region', visible: false).set '0,0,100,200'
14
17
  end
15
18
 
16
19
  click_button 'Save changes'
@@ -32,7 +35,10 @@ describe 'Add and update the site masthead', type: :feature do
32
35
 
33
36
  within '#site-masthead' do
34
37
  check 'Show background image in masthead'
35
- attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
38
+ # attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
39
+ # The JS fills in these fields:
40
+ find('#site_masthead_attributes_iiif_tilesource', visible: false).set 'http://test.host/images/7'
41
+ find('#site_masthead_attributes_iiif_region', visible: false).set '0,0,100,200'
36
42
  end
37
43
 
38
44
  click_button 'Save changes'
@@ -44,6 +50,7 @@ describe 'Add and update the site masthead', type: :feature do
44
50
  click_button 'Save changes'
45
51
  expect(page).to have_css('.image-masthead .background-container')
46
52
  end
53
+
47
54
  it 'displays a masthead image when one is uploaded and configured' do
48
55
  visit spotlight.edit_site_path
49
56
 
@@ -54,13 +61,16 @@ describe 'Add and update the site masthead', type: :feature do
54
61
  within '#site-masthead' do
55
62
  check 'Show background image in masthead'
56
63
 
57
- attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
64
+ # attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
65
+ find('#site_masthead_attributes_iiif_tilesource', visible: false).set 'http://test.host/images/7'
66
+ find('#site_masthead_attributes_iiif_region', visible: false).set '0,0,100,200'
58
67
  end
59
68
 
60
69
  click_button 'Save changes'
61
70
  expect(page).to have_content('The site was successfully updated.')
62
71
  expect(page).to have_css('.image-masthead .background-container')
63
72
  end
73
+
64
74
  it 'does not display an uploaded masthead if configured to not display' do
65
75
  visit spotlight.edit_site_path
66
76
 
@@ -69,7 +79,7 @@ describe 'Add and update the site masthead', type: :feature do
69
79
  click_link 'Site masthead'
70
80
 
71
81
  within '#site-masthead' do
72
- attach_file('site_masthead_attributes_image', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
82
+ attach_file('site_masthead_attributes_file', File.absolute_path(File.join(FIXTURES_PATH, 'avatar.png')))
73
83
  end
74
84
 
75
85
  click_button 'Save changes'
@@ -0,0 +1,58 @@
1
+
2
+ {
3
+ "@context":"http://iiif.io/api/presentation/2/context.json",
4
+ "@id":"https://purl.stanford.edu/gk446cj2442/iiif/manifest",
5
+ "@type":"sc:Manifest",
6
+ "label":"[World map",
7
+ "attribution":"This work has been identified as being free of known restrictions under copyright law, including all related and neighboring rights. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.",
8
+ "seeAlso":{
9
+ "@id":"https://purl.stanford.edu/gk446cj2442.mods",
10
+ "format":"application/mods+xml"
11
+ },
12
+ "thumbnail":{
13
+ "@id":"https://stacks.stanford.edu/image/iiif/gk446cj2442%2Fgk446cj2442_05_0001/full/!400,400/0/default.jpg",
14
+ "@type":"dctypes:Image",
15
+ "format":"image/jpeg",
16
+ "service":{
17
+ "@context":"http://iiif.io/api/image/2/context.json",
18
+ "@id":"https://stacks.stanford.edu/image/iiif/gk446cj2442%2Fgk446cj2442_05_0001",
19
+ "profile":"http://iiif.io/api/image/2/level1.json"
20
+ }
21
+ },
22
+ "sequences":[
23
+ {
24
+ "@id":"https://purl.stanford.edu/gk446cj2442#sequence-1",
25
+ "@type":"sc:Sequence",
26
+ "label":"Current order",
27
+ "canvases":[
28
+ {
29
+ "@id":"https://purl.stanford.edu/gk446cj2442/iiif/canvas/gk446cj2442_1",
30
+ "@type":"sc:Canvas",
31
+ "label":"mclaughlin_gk446cj2442",
32
+ "height":3943,
33
+ "width":4956,
34
+ "images":[
35
+ {
36
+ "@id":"https://purl.stanford.edu/gk446cj2442/iiif/annotation/gk446cj2442_1",
37
+ "@type":"oa:Annotation",
38
+ "motivation":"sc:painting",
39
+ "resource":{
40
+ "@id":"https://stacks.stanford.edu/image/iiif/gk446cj2442%2Fgk446cj2442_05_0001/full/full/0/default.jpg",
41
+ "@type":"dctypes:Image",
42
+ "format":"image/jpeg",
43
+ "height":3943,
44
+ "width":4956,
45
+ "service":{
46
+ "@context":"http://iiif.io/api/image/2/context.json",
47
+ "@id":"https://stacks.stanford.edu/image/iiif/gk446cj2442%2Fgk446cj2442_05_0001",
48
+ "profile":"http://iiif.io/api/image/2/level1.json"
49
+ }
50
+ },
51
+ "on":"https://purl.stanford.edu/gk446cj2442/iiif/canvas/gk446cj2442_1"
52
+ }
53
+ ]
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ }
@@ -0,0 +1,274 @@
1
+ module IiifResponses
2
+ def complex_collection
3
+ {
4
+ "@id": 'uri://for-top-level-collection',
5
+ "@type": 'sc:Collection',
6
+ "label": 'Complex Collection',
7
+ "collections": [
8
+ {
9
+ "@id": 'uri://for-child-collection1',
10
+ "@type": 'sc:Collection',
11
+ "label": 'Child Collection 1'
12
+ },
13
+ {
14
+ "@id": 'uri://for-child-collection2',
15
+ "@type": 'sc:Collection',
16
+ "label": 'Child Collection 2'
17
+ }
18
+ ],
19
+ "manifests": [
20
+ {
21
+ "@id": 'uri://for-manifest1',
22
+ "@type": 'sc:Manifest',
23
+ "label": 'Test Manifest 1'
24
+ }
25
+ ]
26
+ }.to_json
27
+ end
28
+
29
+ def child_collection1
30
+ {
31
+ "@id": 'uri://for-child-collection1',
32
+ "@type": 'sc:Collection',
33
+ "label": 'Child Collection 1',
34
+ "collections": [
35
+ {
36
+ "@id": 'uri://for-child-collection3',
37
+ "@type": 'sc:Collection',
38
+ "label": 'Child Collection 3'
39
+ }
40
+ ],
41
+ "manifests": [
42
+ {
43
+ "@id": 'uri://for-manifest2',
44
+ "@type": 'sc:Manifest',
45
+ "label": 'Test Manifest 2'
46
+ }
47
+ ]
48
+ }.to_json
49
+ end
50
+
51
+ def child_collection2
52
+ {
53
+ "@id": 'uri://for-child-collection2',
54
+ "@type": 'sc:Collection',
55
+ "label": 'Child Collection 2',
56
+ "manifests": [
57
+ {
58
+ "@id": 'uri://for-manifest4',
59
+ "@type": 'sc:Manifest',
60
+ "label": 'Test Manifest 4'
61
+ }
62
+ ]
63
+ }.to_json
64
+ end
65
+
66
+ def child_collection3
67
+ {
68
+ "@id": 'uri://for-child-collection3',
69
+ "@type": 'sc:Collection',
70
+ "label": 'Child Collection 3',
71
+ "manifests": [
72
+ {
73
+ "@id": 'uri://for-manifest3',
74
+ "@type": 'sc:Manifest',
75
+ "label": 'Test Manifest 3'
76
+ }
77
+ ]
78
+ }.to_json
79
+ end
80
+
81
+ def test_manifest1
82
+ {
83
+ "@id": 'uri://for-manifest1',
84
+ "@type": 'sc:Manifest',
85
+ "label": 'Test Manifest 1',
86
+ "attribution": 'Attribution Data',
87
+ "description": 'A test IIIF manifest',
88
+ "license": 'http://www.example.org/license.html',
89
+ "metadata": [
90
+ {
91
+ "label": 'Author',
92
+ "value": 'John Doe'
93
+ },
94
+ {
95
+ "label": 'Author',
96
+ "value": 'Jane Doe'
97
+ },
98
+ {
99
+ "label": 'Another Field',
100
+ "value": 'Some data'
101
+ }
102
+ ],
103
+ "thumbnail": {
104
+ "@id": 'uri://to-thumbnail'
105
+ },
106
+ "sequences": [
107
+ {
108
+ "@type": 'sc:Sequence',
109
+ "canvases": [
110
+ {
111
+ "@type": 'sc:Canvas',
112
+ "images": [
113
+ {
114
+ "@type": 'oa:Annotation',
115
+ "resource": {
116
+ "@type": 'dcterms:Image',
117
+ "@id": 'uri://full-image',
118
+ "service": {
119
+ "@id": 'uri://to-image-service'
120
+ }
121
+ }
122
+ }
123
+ ]
124
+ }
125
+ ]
126
+ }
127
+ ]
128
+ }.to_json
129
+ end
130
+
131
+ def test_manifest2
132
+ {
133
+ "@id": 'uri://for-manifest2',
134
+ "@type": 'sc:Manifest',
135
+ "label": 'Test Manifest 2',
136
+ "attribution": 'Attribution Data',
137
+ "description": 'A test IIIF manifest',
138
+ "license": 'http://www.example.org/license.html',
139
+ "metadata": [
140
+ {
141
+ "label": 'Contributor',
142
+ "value": 'John Doe'
143
+ },
144
+ {
145
+ "label": 'Yet Another Field',
146
+ "value": 'Some data'
147
+ }
148
+ ],
149
+ "thumbnail": {
150
+ "@id": 'uri://to-thumbnail'
151
+ },
152
+ "sequences": [
153
+ {
154
+ "@type": 'sc:Sequence',
155
+ "canvases": [
156
+ {
157
+ "@type": 'sc:Canvas',
158
+ "images": [
159
+ {
160
+ "@type": 'oa:Annotation',
161
+ "resource": {
162
+ "@type": 'dcterms:Image',
163
+ "service": {
164
+ "@id": 'uri://to-image-service'
165
+ }
166
+ }
167
+ },
168
+ {
169
+ "@type": 'oa:Annotation',
170
+ "resource": {
171
+ "@type": 'dcterms:Image',
172
+ "service": {
173
+ "@id": 'uri://to-image-service2'
174
+ }
175
+ }
176
+ }
177
+ ]
178
+ }
179
+ ]
180
+ }
181
+ ]
182
+ }.to_json
183
+ end
184
+
185
+ def test_manifest3
186
+ {
187
+ "@id": 'uri://for-manifest3',
188
+ "@type": 'sc:Manifest',
189
+ "label": 'Test Manifest 3',
190
+ "attribution": 'Attribution Data',
191
+ "description": 'A test IIIF manifest',
192
+ "license": 'http://www.example.org/license.html',
193
+ "metadata": [
194
+ {
195
+ "label": 'Author',
196
+ "value": 'Jane Doe'
197
+ },
198
+ {
199
+ "label": 'Collection',
200
+ "value": 'Some Collection'
201
+ }
202
+ ],
203
+ "thumbnail": {
204
+ "@id": 'uri://to-thumbnail'
205
+ },
206
+ "sequences": [
207
+ {
208
+ "@type": 'sc:Sequence',
209
+ "canvases": [
210
+ {
211
+ "@type": 'sc:Canvas',
212
+ "images": [
213
+ {
214
+ "@type": 'oa:Annotation',
215
+ "resource": {
216
+ "@type": 'dcterms:Image',
217
+ "service": {
218
+ "@id": 'uri://to-image-service'
219
+ }
220
+ }
221
+ }
222
+ ]
223
+ }
224
+ ]
225
+ }
226
+ ]
227
+ }.to_json
228
+ end
229
+
230
+ def test_manifest4
231
+ {
232
+ "@id": 'uri://for-manifest4',
233
+ "@type": 'sc:Manifest',
234
+ "label": 'Test Manifest 4',
235
+ "attribution": 'Attribution Data',
236
+ "description": 'A test IIIF manifest',
237
+ "license": 'http://www.example.org/license.html',
238
+ "metadata": [
239
+ {
240
+ "label": 'Contributor',
241
+ "value": 'Jane Doe'
242
+ },
243
+ {
244
+ "label": 'Location',
245
+ "value": 'Some location'
246
+ }
247
+ ],
248
+ "thumbnail": {
249
+ "@id": 'uri://to-thumbnail'
250
+ },
251
+ "sequences": [
252
+ {
253
+ "@type": 'sc:Sequence',
254
+ "canvases": [
255
+ {
256
+ "@type": 'sc:Canvas',
257
+ "images": [
258
+ {
259
+ "@type": 'oa:Annotation',
260
+ "resource": {
261
+ "@type": 'dcterms:Image',
262
+ "service": {
263
+ "@id": 'uri://to-image-service'
264
+ }
265
+ }
266
+ }
267
+ ]
268
+ }
269
+ ]
270
+ }
271
+ ]
272
+ }.to_json
273
+ end
274
+ end