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.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/assets/images/spotlight/default_browse_thumbnail.jpg +0 -0
- data/app/assets/javascripts/spotlight/application.js +6 -1
- data/app/assets/javascripts/spotlight/blocks/pages_block.js +1 -1
- data/app/assets/javascripts/spotlight/blocks/resources_block.js +7 -4
- data/app/assets/javascripts/spotlight/blocks/solr_documents_base_block.js +108 -0
- data/app/assets/javascripts/spotlight/blocks/solr_documents_block.js +12 -56
- data/app/assets/javascripts/spotlight/blocks/solr_documents_carousel_block.js +3 -3
- data/app/assets/javascripts/spotlight/blocks/solr_documents_embed_block.js +3 -3
- data/app/assets/javascripts/spotlight/blocks/solr_documents_features_block.js +3 -3
- data/app/assets/javascripts/spotlight/blocks/solr_documents_grid_block.js +3 -3
- data/app/assets/javascripts/spotlight/crop.es6 +205 -0
- data/app/assets/javascripts/spotlight/croppable.js +7 -104
- data/app/assets/javascripts/spotlight/iiif.es6 +54 -0
- data/app/assets/javascripts/spotlight/multi_image_selector.js +34 -16
- data/app/assets/javascripts/spotlight/pages.js.erb +1 -1
- data/app/assets/javascripts/spotlight/reindex_monitor.js +5 -1
- data/app/assets/javascripts/spotlight/search_typeahead.js +33 -47
- data/app/assets/javascripts/spotlight/sir-trevor/locales.js +5 -2
- data/app/assets/javascripts/spotlight/zpr_links.js.erb +30 -0
- data/app/assets/stylesheets/spotlight/_croppable.scss +8 -13
- data/app/assets/stylesheets/spotlight/_multi_image_selector.scss +1 -1
- data/app/assets/stylesheets/spotlight/_pages.scss +5 -0
- data/app/assets/stylesheets/spotlight/typeahead.css +0 -1
- data/app/controllers/concerns/spotlight/base.rb +3 -5
- data/app/controllers/spotlight/appearances_controller.rb +6 -4
- data/app/controllers/spotlight/catalog_controller.rb +10 -0
- data/app/controllers/spotlight/contacts_controller.rb +2 -6
- data/app/controllers/spotlight/featured_images_controller.rb +26 -0
- data/app/controllers/spotlight/pages_controller.rb +3 -2
- data/app/controllers/spotlight/resources/iiif_harvester_controller.rb +10 -0
- data/app/controllers/spotlight/resources/upload_controller.rb +4 -3
- data/app/controllers/spotlight/searches_controller.rb +20 -6
- data/app/controllers/spotlight/sites_controller.rb +2 -5
- data/app/helpers/spotlight/application_helper.rb +14 -1
- data/app/helpers/spotlight/crop_helper.rb +37 -0
- data/app/helpers/spotlight/main_app_helpers.rb +13 -0
- data/app/helpers/spotlight/meta_helper.rb +10 -20
- data/app/models/concerns/spotlight/solr_document.rb +1 -2
- data/app/models/concerns/spotlight/solr_document/uploaded_resource.rb +1 -23
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +10 -0
- data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +10 -0
- data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +5 -0
- data/app/models/spotlight/analytics/ga.rb +1 -1
- data/app/models/spotlight/blacklight_configuration.rb +16 -8
- data/app/models/spotlight/contact.rb +2 -13
- data/app/models/spotlight/contact_image.rb +11 -0
- data/app/models/spotlight/exhibit.rb +11 -8
- data/app/models/spotlight/exhibit_thumbnail.rb +12 -0
- data/app/models/spotlight/feature_page.rb +3 -5
- data/app/models/spotlight/featured_image.rb +28 -9
- data/app/models/spotlight/home_page.rb +2 -0
- data/app/models/spotlight/masthead.rb +5 -11
- data/app/models/spotlight/page.rb +5 -0
- data/app/models/spotlight/reindex_progress.rb +10 -18
- data/app/models/spotlight/reindexing_log_entry.rb +1 -0
- data/app/models/spotlight/resources/iiif_harvester.rb +33 -0
- data/app/models/spotlight/resources/iiif_manifest.rb +211 -0
- data/app/models/spotlight/resources/iiif_service.rb +93 -0
- data/app/models/spotlight/resources/upload.rb +1 -2
- data/app/models/spotlight/search.rb +5 -34
- data/app/presenters/spotlight/iiif_manifest_presenter.rb +79 -0
- data/app/serializers/spotlight/exhibit_export_serializer.rb +9 -41
- data/app/services/spotlight/carrierwave_file_resolver.rb +3 -1
- data/app/services/spotlight/iiif_resource_resolver.rb +73 -0
- data/app/services/spotlight/resources/iiif_builder.rb +17 -0
- data/app/services/spotlight/upload_solr_document_builder.rb +23 -23
- data/app/uploaders/spotlight/attachment_uploader.rb +0 -48
- data/app/uploaders/spotlight/featured_image_uploader.rb +2 -16
- data/app/views/_user_util_links.html.erb +8 -5
- data/app/views/catalog/_save_search.html.erb +4 -2
- data/app/views/layouts/spotlight/spotlight.html.erb +5 -1
- data/app/views/shared/_masthead.html.erb +1 -1
- data/app/views/spotlight/about_pages/_contact_properties.html.erb +1 -1
- data/app/views/spotlight/appearances/edit.html.erb +26 -6
- data/app/views/spotlight/browse/_search.html.erb +1 -1
- data/app/views/spotlight/contacts/_form.html.erb +12 -7
- data/app/views/spotlight/dashboards/_reindexing_activity.html.erb +1 -1
- data/app/views/spotlight/exhibits/_exhibit_card_front.html.erb +2 -2
- data/app/views/spotlight/featured_images/_form.html.erb +12 -15
- data/app/views/spotlight/featured_images/_upload_form.html.erb +6 -12
- data/app/views/spotlight/metadata_configurations/_metadata_field.html.erb +3 -3
- data/app/views/spotlight/pages/_form.html.erb +3 -3
- data/app/views/spotlight/pages/edit.html.erb +4 -2
- data/app/views/spotlight/resources/iiif/_form.html.erb +9 -0
- data/app/views/spotlight/searches/_form.html.erb +3 -3
- data/app/views/spotlight/searches/_search.html.erb +4 -2
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_featured_pages_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +7 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +4 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +4 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb +4 -2
- data/app/views/spotlight/sites/edit.html.erb +1 -1
- data/config/locales/spotlight.en.yml +31 -6
- data/config/routes.rb +9 -0
- data/db/migrate/20160714144125_add_iiif_urls_to_featured_image.rb +9 -0
- data/db/migrate/20160718194010_add_iiif_url_to_contact.rb +6 -0
- data/db/migrate/20160805143841_add_upload_id_to_resources.rb +6 -0
- data/db/migrate/20170204091234_add_theme_to_spotlight_exhibits.rb +5 -0
- data/lib/generators/spotlight/install_generator.rb +5 -2
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +0 -1
- data/lib/generators/spotlight/templates/spotlight.scss +3 -2
- data/lib/migration/iiif.rb +82 -0
- data/lib/spotlight/engine.rb +22 -10
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +10 -0
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/appearances_controller_spec.rb +31 -18
- data/spec/controllers/spotlight/catalog_controller_spec.rb +40 -0
- data/spec/controllers/spotlight/contacts_controller_spec.rb +20 -1
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +2 -6
- data/spec/controllers/spotlight/featured_images_controller_spec.rb +74 -0
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/searches_controller_spec.rb +3 -1
- data/spec/controllers/spotlight/sites_controller_spec.rb +6 -1
- data/spec/examples.txt +1118 -1059
- data/spec/factories/contact_images.rb +6 -0
- data/spec/factories/contacts.rb +4 -1
- data/spec/factories/exhibit_thumbnails.rb +6 -0
- data/spec/factories/exhibits.rb +4 -0
- data/spec/factories/featured_images.rb +1 -0
- data/spec/factories/resources.rb +2 -1
- data/spec/features/add_contacts_spec.rb +5 -5
- data/spec/features/add_iiif_manifest_spec.rb +41 -0
- data/spec/features/add_items_spec.rb +2 -2
- data/spec/features/autocomplete_typeahead_spec.rb +86 -0
- data/spec/features/browse_category_admin_spec.rb +27 -6
- data/spec/features/browse_category_spec.rb +2 -2
- data/spec/features/create_exhibit_spec.rb +3 -3
- data/spec/features/exhibit_masthead_spec.rb +20 -9
- data/spec/features/exhibit_themes_spec.rb +25 -0
- data/spec/features/home_page_spec.rb +1 -1
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +42 -0
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +5 -3
- data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
- data/spec/features/javascript/multi_image_select_spec.rb +5 -6
- data/spec/features/javascript/search_config_admin_spec.rb +1 -1
- data/spec/features/site_masthead_spec.rb +14 -4
- data/spec/fixtures/gk446cj2442-manifest.json +58 -0
- data/spec/fixtures/iiif_responses.rb +274 -0
- data/spec/fixtures/sample_solr_documents.yml +106 -0
- data/spec/helpers/spotlight/crop_helper_spec.rb +9 -0
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +45 -0
- data/spec/helpers/spotlight/meta_helper_spec.rb +2 -15
- data/spec/lib/migration/iiif_spec.rb +70 -0
- data/spec/models/spotlight/blacklight_configuration_spec.rb +17 -5
- data/spec/models/spotlight/contact_image_spec.rb +9 -0
- data/spec/models/spotlight/exhibit_spec.rb +17 -20
- data/spec/models/spotlight/exhibit_thumbnail_spec.rb +8 -0
- data/spec/models/spotlight/featured_image_spec.rb +59 -10
- data/spec/models/spotlight/masthead_spec.rb +33 -17
- data/spec/models/spotlight/page_spec.rb +14 -0
- data/spec/models/spotlight/reindex_progress_spec.rb +22 -73
- data/spec/models/spotlight/resources/iiif_harvester_spec.rb +30 -0
- data/spec/models/spotlight/resources/iiif_manifest_spec.rb +107 -0
- data/spec/models/spotlight/resources/iiif_service_spec.rb +52 -0
- data/spec/models/spotlight/resources/upload_spec.rb +7 -3
- data/spec/models/spotlight/search_spec.rb +0 -45
- data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +11 -29
- data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +123 -0
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +4 -0
- data/spec/routing/spotlight/featured_images_spec.rb +21 -0
- data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +15 -18
- data/spec/services/spotlight/iiif_resource_resolver_spec.rb +90 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/features/test_features_helpers.rb +3 -2
- data/spec/support/stub_iiif_response.rb +24 -0
- data/spec/support/views/test_view_helpers.rb +1 -0
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/uploaders/spotlight/attachment_uploader_spec.rb +24 -0
- data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +30 -0
- data/spec/views/_user_util_links.html.erb_spec.rb +9 -5
- data/spec/views/shared/_masthead.html.erb_spec.rb +5 -2
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +2 -2
- data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +4 -7
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +7 -2
- data/spec/views/spotlight/pages/edit.html.erb_spec.rb +3 -1
- data/spec/views/spotlight/pages/new.html.erb_spec.rb +3 -1
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +3 -2
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +3 -2
- data/vendor/assets/javascripts/leaflet-areaselect.js +184 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +230 -0
- data/vendor/assets/javascripts/leaflet.js +9 -0
- data/vendor/assets/javascripts/polyfill.min.js +4 -0
- data/vendor/assets/stylesheets/leaflet-areaselect.css +15 -0
- data/vendor/assets/stylesheets/leaflet.css +624 -0
- metadata +136 -62
- data/app/assets/javascripts/spotlight/jcrop.js +0 -1696
- data/app/helpers/spotlight/jcrop_helper.rb +0 -37
- data/app/models/concerns/spotlight/default_thumbnailable.rb +0 -25
- data/app/models/concerns/spotlight/image_derivatives.rb +0 -58
- data/app/models/concerns/spotlight/solr_document/spotlight_images.rb +0 -55
- data/app/uploaders/spotlight/avatar_uploader.rb +0 -24
- data/app/uploaders/spotlight/item_uploader.rb +0 -25
- data/app/uploaders/spotlight/masthead_uploader.rb +0 -22
- data/spec/helpers/spotlight/jcrop_helper_spec.rb +0 -33
- data/spec/models/spotlight/default_thumbnailable_concern_spec.rb +0 -16
- data/spec/models/spotlight/image_derivatives_spec.rb +0 -15
- data/spec/models/spotlight/solr_document/spotlight_images_spec.rb +0 -42
- data/spec/uploaders/spotlight/item_uploader_spec.rb +0 -67
@@ -25,7 +25,6 @@ module Spotlight
|
|
25
25
|
##
|
26
26
|
# Serialize an exhibit with all the data needed to reconstruct it
|
27
27
|
# in a different environment
|
28
|
-
# rubocop:disable Metrics/ClassLength
|
29
28
|
class ExhibitExportSerializer < Roar::Decorator
|
30
29
|
include Roar::JSON
|
31
30
|
|
@@ -59,7 +58,7 @@ module Spotlight
|
|
59
58
|
|
60
59
|
property :masthead, class: Spotlight::Masthead, decorator: FeaturedImageRepresenter
|
61
60
|
|
62
|
-
property :thumbnail, class: Spotlight::
|
61
|
+
property :thumbnail, class: Spotlight::ExhibitThumbnail, decorator: FeaturedImageRepresenter
|
63
62
|
|
64
63
|
collection :main_navigations, class: Spotlight::MainNavigation, decorator: MainNavigationRepresenter
|
65
64
|
|
@@ -74,25 +73,11 @@ module Spotlight
|
|
74
73
|
|
75
74
|
collection :contacts, populator: ->(fragment, options) { options[:represented].contacts.find_or_initialize_by(slug: fragment['slug']) },
|
76
75
|
class: Spotlight::Contact do
|
77
|
-
(Spotlight::Contact.attribute_names - %w(id exhibit_id
|
76
|
+
(Spotlight::Contact.attribute_names - %w(id exhibit_id)).each do |prop|
|
78
77
|
property prop
|
79
78
|
end
|
80
79
|
|
81
|
-
property :avatar,
|
82
|
-
|
83
|
-
def avatar
|
84
|
-
file = represented.avatar.file
|
85
|
-
|
86
|
-
return unless file
|
87
|
-
|
88
|
-
{ filename: file.filename, content_type: file.content_type, content: Base64.encode64(file.read) }
|
89
|
-
end
|
90
|
-
|
91
|
-
def avatar=(file)
|
92
|
-
represented.avatar = CarrierWave::SanitizedFile.new tempfile: StringIO.new(Base64.decode64(file['content'])),
|
93
|
-
filename: file['filename'],
|
94
|
-
content_type: file['content_type']
|
95
|
-
end
|
80
|
+
property :avatar, class: Spotlight::ContactImage, decorator: FeaturedImageRepresenter
|
96
81
|
end
|
97
82
|
|
98
83
|
collection :contact_emails, class: Spotlight::ContactEmail do
|
@@ -151,39 +136,22 @@ module Spotlight
|
|
151
136
|
end
|
152
137
|
|
153
138
|
collection :resources, class: ->(options) { options[:fragment].key?('type') ? options[:fragment]['type'].constantize : Spotlight::Resource } do
|
154
|
-
(Spotlight::Resource.attribute_names - %w(id
|
139
|
+
(Spotlight::Resource.attribute_names - %w(id upload_id exhibit_id)).each do |prop|
|
155
140
|
property prop
|
156
141
|
end
|
157
142
|
|
158
|
-
property :
|
159
|
-
property :file, exec_context: :decorator
|
160
|
-
|
161
|
-
def url
|
162
|
-
return if represented.is_a? Spotlight::Resources::Upload
|
143
|
+
property :upload, exec_context: :decorator
|
163
144
|
|
164
|
-
|
165
|
-
end
|
166
|
-
|
167
|
-
def url=(url)
|
168
|
-
return if represented.is_a? Spotlight::Resources::Upload
|
169
|
-
|
170
|
-
represented.url = url
|
171
|
-
end
|
172
|
-
|
173
|
-
def file
|
145
|
+
def upload
|
174
146
|
return unless represented.is_a? Spotlight::Resources::Upload
|
175
|
-
file = represented.url.file
|
176
147
|
|
177
|
-
|
148
|
+
FeaturedImageRepresenter.new(represented.upload).to_json
|
178
149
|
end
|
179
150
|
|
180
|
-
def
|
151
|
+
def upload=(json)
|
181
152
|
return unless represented.is_a? Spotlight::Resources::Upload
|
182
|
-
|
183
|
-
filename: file['filename'],
|
184
|
-
content_type: file['content_type']
|
153
|
+
FeaturedImageRepresenter.new(represented.build_upload).from_json(json)
|
185
154
|
end
|
186
155
|
end
|
187
156
|
end
|
188
|
-
# rubocop:enable Metrics/ClassLength
|
189
157
|
end
|
@@ -2,7 +2,9 @@ module Spotlight
|
|
2
2
|
# Used by RIIIF to find files uploaded by carrierwave
|
3
3
|
class CarrierwaveFileResolver < Riiif::AbstractFileSystemResolver
|
4
4
|
def pattern(id)
|
5
|
-
Spotlight::FeaturedImage.find(id).image.file
|
5
|
+
uploaded_file = Spotlight::FeaturedImage.find(id).image.file
|
6
|
+
raise Riiif::ImageNotFoundError, "unable to find file for #{id}" if uploaded_file.nil?
|
7
|
+
uploaded_file.file
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Spotlight
|
2
|
+
###
|
3
|
+
# Update an ActiveRecord resource that containes identifiers for all the
|
4
|
+
# levels of an image resource described in a IIIF manifest
|
5
|
+
#
|
6
|
+
class IiifResourceResolver
|
7
|
+
delegate :iiif_manifest_url, :iiif_canvas_id, :iiif_image_id, to: :resource
|
8
|
+
def initialize(resource)
|
9
|
+
@resource = resource
|
10
|
+
end
|
11
|
+
|
12
|
+
def resolve!
|
13
|
+
resource.iiif_tilesource = updated_tilesource
|
14
|
+
return resource.save if resource.changed?
|
15
|
+
Rails.logger.info("#{self.class.name} resolved #{iiif_manifest_url}, but nothing changed.")
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
attr_reader :resource
|
21
|
+
|
22
|
+
def updated_tilesource
|
23
|
+
"#{updated_image['resource']['service']['@id']}/info.json"
|
24
|
+
end
|
25
|
+
|
26
|
+
def updated_image
|
27
|
+
new_image = updated_canvas['images'].find do |image|
|
28
|
+
image['@id'] == iiif_image_id
|
29
|
+
end
|
30
|
+
|
31
|
+
raise(ManifestError, "No image with @id #{iiif_image_id} found in #{iiif_manifest_url}") unless new_image
|
32
|
+
new_image
|
33
|
+
end
|
34
|
+
|
35
|
+
def updated_canvas
|
36
|
+
new_canvas = canvases.find do |canvas|
|
37
|
+
canvas['@id'] == iiif_canvas_id
|
38
|
+
end
|
39
|
+
|
40
|
+
raise(ManifestError, "No canvas with @id #{iiif_canvas_id} found in #{iiif_manifest_url}") unless new_canvas
|
41
|
+
new_canvas
|
42
|
+
end
|
43
|
+
|
44
|
+
def canvases
|
45
|
+
sequence['canvases'] || []
|
46
|
+
end
|
47
|
+
|
48
|
+
# Currently only supporting a single sequence
|
49
|
+
def sequence
|
50
|
+
Array.wrap(manifest['sequences']).first || {}
|
51
|
+
end
|
52
|
+
|
53
|
+
def response
|
54
|
+
@response ||= begin
|
55
|
+
Faraday.get(iiif_manifest_url).body
|
56
|
+
rescue Faraday::Error => e
|
57
|
+
Rails.logger.warn("#{self.class.name} failed to fetch #{iiif_manifest_url} with: #{e}")
|
58
|
+
'{}'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def manifest
|
63
|
+
@manifest ||= begin
|
64
|
+
JSON.parse(response)
|
65
|
+
rescue JSON::ParserError => e
|
66
|
+
Rails.logger.warn("#{self.class.name} failed to parse #{iiif_manifest_url} with: #{e}")
|
67
|
+
{}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class ManifestError < RuntimeError; end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Spotlight
|
2
|
+
module Resources
|
3
|
+
# transforms a IiifHarvester into solr documents
|
4
|
+
class IiifBuilder < Spotlight::SolrDocumentBuilder
|
5
|
+
def to_solr
|
6
|
+
return to_enum(:to_solr) { 0 } unless block_given?
|
7
|
+
|
8
|
+
base_doc = super
|
9
|
+
resource.iiif_manifests.each do |manifest|
|
10
|
+
manifest.with_exhibit(exhibit)
|
11
|
+
manifest_solr = manifest.to_solr
|
12
|
+
yield base_doc.merge(manifest_solr) if manifest_solr.present?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -4,19 +4,13 @@ module Spotlight
|
|
4
4
|
delegate :compound_id, to: :resource
|
5
5
|
|
6
6
|
def to_solr
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
add_file_versions solr_hash
|
16
|
-
|
17
|
-
add_sidecar_fields solr_hash
|
18
|
-
|
19
|
-
solr_hash
|
7
|
+
super.tap do |solr_hash|
|
8
|
+
add_default_solr_fields solr_hash
|
9
|
+
add_image_dimensions solr_hash
|
10
|
+
add_file_versions solr_hash
|
11
|
+
add_sidecar_fields solr_hash
|
12
|
+
add_manifest_path solr_hash
|
13
|
+
end
|
20
14
|
end
|
21
15
|
|
22
16
|
private
|
@@ -26,23 +20,29 @@ module Spotlight
|
|
26
20
|
end
|
27
21
|
|
28
22
|
def add_image_dimensions(solr_hash)
|
29
|
-
dimensions = ::
|
30
|
-
solr_hash[:spotlight_full_image_width_ssm] = dimensions
|
31
|
-
solr_hash[:spotlight_full_image_height_ssm] = dimensions
|
23
|
+
dimensions = Riiif::Image.new(resource.upload_id).info
|
24
|
+
solr_hash[:spotlight_full_image_width_ssm] = dimensions[:width]
|
25
|
+
solr_hash[:spotlight_full_image_height_ssm] = dimensions[:height]
|
32
26
|
end
|
33
27
|
|
34
28
|
def add_file_versions(solr_hash)
|
35
|
-
|
36
|
-
solr_hash[config[:field]] = if config[:version]
|
37
|
-
resource.url.send(config[:version]).url
|
38
|
-
else
|
39
|
-
resource.url.url
|
40
|
-
end
|
41
|
-
end
|
29
|
+
solr_hash[Spotlight::Engine.config.thumbnail_field] = riiif.image_path(resource.upload_id, size: '400,400')
|
42
30
|
end
|
43
31
|
|
44
32
|
def add_sidecar_fields(solr_hash)
|
45
33
|
solr_hash.merge! resource.sidecar.to_solr
|
46
34
|
end
|
35
|
+
|
36
|
+
def add_manifest_path(solr_hash)
|
37
|
+
solr_hash[Spotlight::Engine.config.iiif_manifest_field] = spotlight_routes.manifest_exhibit_solr_document_path(exhibit, resource.compound_id)
|
38
|
+
end
|
39
|
+
|
40
|
+
def spotlight_routes
|
41
|
+
Spotlight::Engine.routes.url_helpers
|
42
|
+
end
|
43
|
+
|
44
|
+
def riiif
|
45
|
+
Riiif::Engine.routes.url_helpers
|
46
|
+
end
|
47
47
|
end
|
48
48
|
end
|
@@ -3,10 +3,6 @@ module Spotlight
|
|
3
3
|
##
|
4
4
|
# Sir-trevor image widget uploads
|
5
5
|
class AttachmentUploader < CarrierWave::Uploader::Base
|
6
|
-
# Include RMagick or MiniMagick support:
|
7
|
-
# include CarrierWave::RMagick
|
8
|
-
include CarrierWave::MiniMagick
|
9
|
-
|
10
6
|
storage Spotlight::Engine.config.uploader_storage
|
11
7
|
|
12
8
|
# Override the directory where uploaded files will be stored.
|
@@ -14,49 +10,5 @@ module Spotlight
|
|
14
10
|
def store_dir
|
15
11
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
16
12
|
end
|
17
|
-
|
18
|
-
version :large do
|
19
|
-
process resize_to_limit: [850, nil]
|
20
|
-
end
|
21
|
-
|
22
|
-
version :medium do
|
23
|
-
process resize_to_limit: [640, nil]
|
24
|
-
end
|
25
|
-
|
26
|
-
version :small do
|
27
|
-
process resize_to_limit: [320, nil]
|
28
|
-
end
|
29
|
-
|
30
|
-
# Provide a default URL as a default if there hasn't been a file uploaded:
|
31
|
-
# def default_url
|
32
|
-
# # For Rails 3.1+ asset pipeline compatibility:
|
33
|
-
# # ActionController::Base.helpers.asset_path('fallback/' + [version_name, 'default.png'].compact.join('_'))
|
34
|
-
#
|
35
|
-
# "/images/fallback/" + [version_name, 'default.png'].compact.join('_')
|
36
|
-
# end
|
37
|
-
|
38
|
-
# Process files as they are uploaded:
|
39
|
-
# process :scale => [200, 300]
|
40
|
-
#
|
41
|
-
# def scale(width, height)
|
42
|
-
# # do something
|
43
|
-
# end
|
44
|
-
|
45
|
-
# Create different versions of your uploaded files:
|
46
|
-
# version :thumb do
|
47
|
-
# process :scale => [50, 50]
|
48
|
-
# end
|
49
|
-
|
50
|
-
# Add a white list of extensions which are allowed to be uploaded.
|
51
|
-
# For images you might use something like this:
|
52
|
-
# def extension_white_list
|
53
|
-
# %w(jpg jpeg gif png)
|
54
|
-
# end
|
55
|
-
|
56
|
-
# Override the filename of the uploaded files:
|
57
|
-
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
58
|
-
# def filename
|
59
|
-
# "something.jpg" if original_filename
|
60
|
-
# end
|
61
13
|
end
|
62
14
|
end
|
@@ -2,28 +2,14 @@ module Spotlight
|
|
2
2
|
##
|
3
3
|
# Page, browse category, and exhibit featured image thumbnails
|
4
4
|
class FeaturedImageUploader < CarrierWave::Uploader::Base
|
5
|
-
include CarrierWave::MiniMagick
|
6
|
-
|
7
5
|
storage Spotlight::Engine.config.uploader_storage
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
version :thumb, from_version: :cropped do
|
14
|
-
process resize_to_fill: Spotlight::Engine.config.featured_image_thumb_size
|
15
|
-
end
|
16
|
-
|
17
|
-
version :square, from_version: :cropped do
|
18
|
-
process resize_to_fill: Spotlight::Engine.config.featured_image_square_size
|
7
|
+
def extension_white_list
|
8
|
+
Spotlight::Engine.config.allowed_upload_extensions
|
19
9
|
end
|
20
10
|
|
21
11
|
def store_dir
|
22
12
|
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
23
13
|
end
|
24
|
-
|
25
|
-
def default_url
|
26
|
-
ActionController::Base.helpers.image_path('spotlight/fallback/' + [version_name, 'default.png'].compact.join('_'))
|
27
|
-
end
|
28
14
|
end
|
29
15
|
end
|
@@ -11,15 +11,18 @@
|
|
11
11
|
<li class="dropdown">
|
12
12
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=current_user%> <b class="caret"></b></a>
|
13
13
|
<ul class="dropdown-menu">
|
14
|
-
<% if
|
14
|
+
<% if can? :manage, Spotlight::Site.instance %>
|
15
|
+
<li><%= link_to t(:'spotlight.header_links.edit_site'), spotlight.edit_site_path %></li>
|
16
|
+
<% end %>
|
17
|
+
<% if can? :create, Spotlight::Exhibit %>
|
15
18
|
<li>
|
16
|
-
<%= link_to t('spotlight.
|
19
|
+
<%= link_to t(:'spotlight.header_links.create_exhibit'), spotlight.new_exhibit_path %>
|
17
20
|
</li>
|
18
21
|
<li class="divider"></li>
|
19
22
|
<% end %>
|
20
|
-
<% if can?
|
23
|
+
<% if current_exhibit && can?(:curate, current_exhibit) %>
|
21
24
|
<li>
|
22
|
-
<%= link_to t(
|
25
|
+
<%= link_to t('spotlight.header_links.dashboard'), spotlight.exhibit_dashboard_path(current_exhibit) %>
|
23
26
|
</li>
|
24
27
|
<li class="divider"></li>
|
25
28
|
<% end %>
|
@@ -43,4 +46,4 @@
|
|
43
46
|
</li>
|
44
47
|
<% end %>
|
45
48
|
</ul>
|
46
|
-
</div>
|
49
|
+
</div>
|
@@ -8,7 +8,9 @@
|
|
8
8
|
<h4 class="modal-title" id="save-modal-label"><%= t(:'spotlight.saved_search.label') %></h4>
|
9
9
|
</div>
|
10
10
|
<div class="modal-body">
|
11
|
-
<%=f.text_field :title, label: t(:'spotlight.saved_search.title')
|
11
|
+
<%= f.text_field :title, label: t(:'spotlight.saved_search.title') %>
|
12
|
+
<%= label_tag :id, t(:'spotlight.saved_search.id'), class: 'control-label' %>
|
13
|
+
<%= select_tag :id, options_for_select(current_exhibit.searches.map { |s| [s.title, s.id] }), include_blank: true, class: 'form-control' %>
|
12
14
|
<%= render_hash_as_hidden_fields(search_state.params_for_search.except(:qt, :page, :utf8)) %>
|
13
15
|
</div>
|
14
16
|
<div class="modal-footer">
|
@@ -18,4 +20,4 @@
|
|
18
20
|
</div>
|
19
21
|
<% end %>
|
20
22
|
</div>
|
21
|
-
</div>
|
23
|
+
</div>
|
@@ -16,7 +16,11 @@
|
|
16
16
|
<title><%= h(@page_title || application_name) %></title>
|
17
17
|
<link href="<%= current_exhibit ? spotlight.opensearch_exhibit_catalog_url(current_exhibit, format: 'xml') : main_app.opensearch_catalog_url(format: 'xml') %>" title="<%= application_name %>" type="application/opensearchdescription+xml" rel="search"/>
|
18
18
|
<%= favicon_link_tag 'favicon.ico' %>
|
19
|
-
|
19
|
+
<% if current_exhibit %>
|
20
|
+
<%= exhibit_stylesheet_link_tag "application" %>
|
21
|
+
<% else %>
|
22
|
+
<%= stylesheet_link_tag "application" %>
|
23
|
+
<% end %>
|
20
24
|
<%= javascript_include_tag "application" %>
|
21
25
|
<%= csrf_meta_tags %>
|
22
26
|
<%= content_for(:head) %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<div class="masthead <%= 'image-masthead' if current_masthead %> <%= 'resource-masthead' if resource_masthead? %>">
|
4
4
|
<% if current_masthead %>
|
5
|
-
<span class='background-container' style="background-image: url('<%=
|
5
|
+
<span class='background-container' style="background-image: url('<%= current_masthead.iiif_url %>')"></span>
|
6
6
|
<span class='background-container-gradient'></span>
|
7
7
|
<% end %>
|
8
8
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= image_tag contact.avatar.
|
1
|
+
<%= image_tag contact.avatar.iiif_url, class: 'contact-photo' if contact.avatar && contact.avatar.iiif_url.present? %>
|
2
2
|
<div itemprop="name" class="name"><%= contact.name %></div>
|
3
3
|
<% Spotlight::Contact.fields.each do |field, options| %>
|
4
4
|
<% if (value = contact.contact_info[field]).present? %>
|
@@ -16,10 +16,16 @@
|
|
16
16
|
<% end %>
|
17
17
|
<div role="tabpanel">
|
18
18
|
<ul class="nav nav-tabs" role="tablist">
|
19
|
-
|
19
|
+
<% if Spotlight::Engine.config.exhibit_themes.many? %>
|
20
|
+
<li role="presentation" class="active">
|
21
|
+
<a href="#site-theme" aria-controls="site-theme" role="tab" data-toggle="tab"><%= t(:'.site_theme.heading') %></a>
|
22
|
+
</li>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<li role="presentation" <%= 'class="active"'.html_safe unless Spotlight::Engine.config.exhibit_themes.many? %>>
|
20
26
|
<a href="#site-masthead" aria-controls="site-masthead" role="tab" data-toggle="tab"><%= t(:'.site_masthead.heading') %></a>
|
21
27
|
</li>
|
22
|
-
|
28
|
+
|
23
29
|
<li role="presentation">
|
24
30
|
<a href="#site-thumbnail" aria-controls="site-thumbnail" role="tab" data-toggle="tab"><%= t(:'.site_thumbnail.heading') %></a>
|
25
31
|
</li>
|
@@ -29,17 +35,31 @@
|
|
29
35
|
</li>
|
30
36
|
</ul>
|
31
37
|
<div class="tab-content">
|
32
|
-
|
38
|
+
<% if Spotlight::Engine.config.exhibit_themes.many? %>
|
39
|
+
<div role="tabpanel" class="tab-pane active" id="site-theme">
|
40
|
+
<p class="instructions"><%= t(:'.site_theme.help') %></p>
|
41
|
+
<%= f.form_group :theme, label: { text: t(:'.site_theme.label') } do %>
|
42
|
+
<% Spotlight::Engine.config.exhibit_themes.each do |theme| %>
|
43
|
+
<div class="col-md-6">
|
44
|
+
<%= image_tag "spotlight/themes/#{theme}_preview", width: 100, height: 100 %>
|
45
|
+
<%= f.radio_button :theme, theme, label: t(:".site_theme.#{theme}", default: theme.to_s.titleize), inline: true %>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
<div role="tabpanel" class="tab-pane <%= 'active' unless Spotlight::Engine.config.exhibit_themes.many? %>" id="site-masthead">
|
33
53
|
<p class="instructions"><%= t(:'.site_masthead.help') %></p>
|
34
54
|
<%= f.fields_for(:masthead, current_exhibit.masthead || current_exhibit.build_masthead) do |m| %>
|
35
|
-
<%= render '/spotlight/featured_images/form', f: m,
|
55
|
+
<%= render '/spotlight/featured_images/form', f: m, initial_crop_selection: Spotlight::Engine.config.masthead_initial_crop_selection, crop_type: :masthead %>
|
36
56
|
<% end %>
|
37
57
|
</div>
|
38
|
-
|
58
|
+
|
39
59
|
<div role="tabpanel" class="tab-pane" id="site-thumbnail">
|
40
60
|
<p class="instructions"><%= t(:'.site_thumbnail.help') %></p>
|
41
61
|
<%= f.fields_for(:thumbnail, current_exhibit.thumbnail || current_exhibit.build_thumbnail) do |m| %>
|
42
|
-
<%= render '/spotlight/featured_images/form', f: m,
|
62
|
+
<%= render '/spotlight/featured_images/form', f: m, initial_crop_selection: Spotlight::Engine.config.thumbnail_initial_crop_selection, crop_type: :thumbnail %>
|
43
63
|
<% end %>
|
44
64
|
</div>
|
45
65
|
|