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
@@ -1,118 +1,21 @@
|
|
1
1
|
Spotlight.onLoad(function() {
|
2
|
-
$('[data-
|
2
|
+
$('[data-behavior="iiif-cropper"]').croppable();
|
3
3
|
});
|
4
4
|
|
5
5
|
|
6
6
|
/*
|
7
|
-
|
8
|
-
|
9
|
-
Add jcrop data-attributes to file input (with data-croppable='true') to instantiate.
|
10
|
-
Adds initialSetSelect option to set a select box on the intial upload of an object.
|
7
|
+
IIIF image cropping plugin
|
8
|
+
Add iiif-crop data-attributes to file input (with data-behavior='iiif-cropper') to instantiate.
|
11
9
|
*/
|
12
10
|
|
13
11
|
(function($) {
|
14
|
-
$.fn.croppable = function(
|
12
|
+
$.fn.croppable = function() {
|
15
13
|
var croppables = this;
|
16
|
-
var opts = opts;
|
17
|
-
var pluginDefults = {
|
18
|
-
setSelect: "[0,0,200,200]"
|
19
|
-
}
|
20
14
|
|
15
|
+
var Crop = require('spotlight/crop');
|
21
16
|
$(croppables).each(function() {
|
22
|
-
var
|
23
|
-
|
24
|
-
var cropinfo = $("#" + cropid + "_crop").val();
|
25
|
-
var cropbox = $("#" + cropid + "_cropbox");
|
26
|
-
var previewbox = $("#" + cropid + "_previewbox");
|
27
|
-
var jcropLoadingArea = cropbox.closest('.croppable-loading-area');
|
28
|
-
|
29
|
-
if(cropinfo == '[0,0,0,0]'){
|
30
|
-
cropinfo = null;
|
31
|
-
}
|
32
|
-
|
33
|
-
var defaults = {
|
34
|
-
setSelect: $.parseJSON(cropinfo || JSON.stringify(fileUpload.data('initialSetSelect')) || pluginDefults['setSelect']),
|
35
|
-
selector: cropid
|
36
|
-
}
|
37
|
-
|
38
|
-
var options = $.extend(defaults, fileUpload.data(), opts);
|
39
|
-
|
40
|
-
function updatePreview(coords) {
|
41
|
-
previewbox.css({
|
42
|
-
width: Math.round(100/coords.w * cropbox.width()) + 'px',
|
43
|
-
height: Math.round(100/coords.h * cropbox.height()) + 'px',
|
44
|
-
marginLeft: '-' + Math.round(100/coords.w * coords.x) + 'px',
|
45
|
-
marginTop: '-' + Math.round(100/coords.h * coords.y) + 'px'
|
46
|
-
});
|
47
|
-
};
|
48
|
-
|
49
|
-
function update(coords) {
|
50
|
-
$('#' + cropid + '_crop_x').val(coords.x);
|
51
|
-
$('#' + cropid + '_crop_y').val(coords.y);
|
52
|
-
$('#' + cropid + '_crop_w').val(coords.w);
|
53
|
-
$('#' + cropid + '_crop_h').val(coords.h);
|
54
|
-
updatePreview(coords);
|
55
|
-
};
|
56
|
-
|
57
|
-
if(!cropbox.data('jcropProcessed')){
|
58
|
-
// Hack to get cropbox image element to be loaded under turbolinks
|
59
|
-
if (cropbox[0].complete === false && cropbox[0].src == window.location.href) {
|
60
|
-
// add 1x1 gif to to img tag so it's loaded
|
61
|
-
cropbox[0].src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==';
|
62
|
-
}
|
63
|
-
|
64
|
-
cropbox.Jcrop(
|
65
|
-
$.extend(options, {
|
66
|
-
onSelect: update,
|
67
|
-
onChange: update
|
68
|
-
})
|
69
|
-
);
|
70
|
-
}
|
71
|
-
cropbox.data('jcropProcessed', 'true');
|
72
|
-
|
73
|
-
cropbox.on('load', function(){
|
74
|
-
jcropLoadingArea.removeClass("loading-jcrop");
|
75
|
-
var jcrop_api = cropbox.data('Jcrop');
|
76
|
-
if(jcrop_api) {
|
77
|
-
jcrop_api.setSelect(options['setSelect']);
|
78
|
-
serializeObservedForms(observedForms());
|
79
|
-
}
|
80
|
-
});
|
81
|
-
|
82
|
-
fileUpload.on('change', function() {
|
83
|
-
var jcrop_api = cropbox.data('Jcrop');
|
84
|
-
jcropLoadingArea.addClass("loading-jcrop");
|
85
|
-
if(this.files){
|
86
|
-
var file = this.files[0];
|
87
|
-
var img = cropbox[0];
|
88
|
-
|
89
|
-
img.file = file;
|
90
|
-
|
91
|
-
var reader = new FileReader();
|
92
|
-
|
93
|
-
reader.onload = (function(aImg) { return function(e) {
|
94
|
-
jcrop_api.setImage(e.target.result);
|
95
|
-
cropbox.css({width: "", height: ""});
|
96
|
-
cropbox[0].src = e.target.result;
|
97
|
-
if(previewbox.length > 0) {
|
98
|
-
previewbox[0].src = e.target.result;
|
99
|
-
}
|
100
|
-
jcrop_api.setSelect(options['setSelect']);
|
101
|
-
}; })(img);
|
102
|
-
reader.readAsDataURL(file);
|
103
|
-
}else{
|
104
|
-
var url = $(this).attr('value');
|
105
|
-
jcrop_api.setImage(url);
|
106
|
-
cropbox.css({width: "", height: ""});
|
107
|
-
cropbox[0].src = url;
|
108
|
-
if(previewbox.length > 0) {
|
109
|
-
previewbox[0].src = url;
|
110
|
-
}
|
111
|
-
jcrop_api.setSelect(options['setSelect']);
|
112
|
-
}
|
113
|
-
cropbox.closest('.missing-croppable').removeClass('missing-croppable');
|
114
|
-
});
|
115
|
-
|
17
|
+
var cropElement = $(this);
|
18
|
+
new Crop(cropElement);
|
116
19
|
});
|
117
20
|
|
118
21
|
return this;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
export default class Iiif {
|
2
|
+
constructor(manifestUrl, manifest) {
|
3
|
+
this.manifestUrl = manifestUrl;
|
4
|
+
this.manifest = manifest;
|
5
|
+
}
|
6
|
+
|
7
|
+
sequences() {
|
8
|
+
var it = {};
|
9
|
+
var context = this;
|
10
|
+
it[Symbol.iterator] = function*() {
|
11
|
+
for (let sequence of context.manifest.sequences) {
|
12
|
+
yield sequence;
|
13
|
+
};
|
14
|
+
}
|
15
|
+
return it;
|
16
|
+
}
|
17
|
+
|
18
|
+
canvases() {
|
19
|
+
var it = {};
|
20
|
+
var context = this;
|
21
|
+
it[Symbol.iterator] = function*() {
|
22
|
+
for (let sequence of context.sequences()) {
|
23
|
+
for (let canvas of sequence.canvases) {
|
24
|
+
yield canvas;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
return it;
|
29
|
+
}
|
30
|
+
|
31
|
+
images() {
|
32
|
+
var it = {};
|
33
|
+
var context = this;
|
34
|
+
it[Symbol.iterator] = function*() {
|
35
|
+
for (let canvas of context.canvases()) {
|
36
|
+
for (let image of canvas.images) {
|
37
|
+
var iiifService = image.resource.service['@id'];
|
38
|
+
yield {
|
39
|
+
'thumb': iiifService + '/full/!100,100/0/default.jpg',
|
40
|
+
'tilesource': iiifService + '/info.json',
|
41
|
+
'manifest': context.manifestUrl,
|
42
|
+
'canvasId': canvas['@id'],
|
43
|
+
'imageId': image['@id']
|
44
|
+
};
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return it;
|
49
|
+
}
|
50
|
+
|
51
|
+
imagesArray() {
|
52
|
+
return Array.from(this.images())
|
53
|
+
}
|
54
|
+
}
|
@@ -1,18 +1,20 @@
|
|
1
1
|
// Module to add multi-image selector to widget panels
|
2
2
|
|
3
3
|
(function(){
|
4
|
-
$.fn.multiImageSelector = function(image_versions) {
|
5
|
-
var changeLink = $("
|
4
|
+
$.fn.multiImageSelector = function(image_versions, clickCallback, activeImageId) {
|
5
|
+
var changeLink = $("<a href='javascript:;'>Change</a>"),
|
6
6
|
thumbsListContainer = $("<div class='thumbs-list' style='display:none'></div>"),
|
7
|
-
thumbList = $("<ul></ul>"),
|
7
|
+
thumbList = $("<ul class='pagination'></ul>"),
|
8
8
|
panel;
|
9
9
|
|
10
|
-
var
|
10
|
+
var imageIds = $.map(image_versions, function(e) { return e['imageId']; });
|
11
11
|
|
12
12
|
return init(this);
|
13
13
|
|
14
14
|
function init(el) {
|
15
15
|
panel = el;
|
16
|
+
|
17
|
+
destroyExistingImageSelector();
|
16
18
|
if(image_versions && image_versions.length > 1) {
|
17
19
|
addChangeLink();
|
18
20
|
addThumbsList();
|
@@ -20,16 +22,21 @@
|
|
20
22
|
}
|
21
23
|
function addChangeLink() {
|
22
24
|
$('[data-panel-image-pagination]', panel)
|
23
|
-
.html("Image <span data-current-image='true'>" + indexOf(
|
25
|
+
.html("Image <span data-current-image='true'>" + indexOf(activeImageId) + "</span> of " + image_versions.length)
|
24
26
|
.show()
|
27
|
+
.append(" ")
|
25
28
|
.append(changeLink);
|
26
29
|
addChangeLinkBehavior();
|
27
30
|
}
|
28
|
-
|
29
|
-
|
31
|
+
|
32
|
+
function destroyExistingImageSelector() {
|
33
|
+
var pagination = $('[data-panel-image-pagination]', panel);
|
34
|
+
pagination.html('');
|
35
|
+
pagination.next('.' + thumbsListContainer.attr('class')).remove();
|
30
36
|
}
|
37
|
+
|
31
38
|
function indexOf(thumb){
|
32
|
-
if( (index =
|
39
|
+
if( (index = imageIds.indexOf(thumb)) > -1 ){
|
33
40
|
return index + 1;
|
34
41
|
} else {
|
35
42
|
return 1;
|
@@ -91,28 +98,39 @@
|
|
91
98
|
function updateActiveThumb(){
|
92
99
|
$('li', thumbList).each(function(){
|
93
100
|
var item = $(this);
|
94
|
-
if($('img', item).
|
101
|
+
if($('img', item).data('image-id') == activeImageId){
|
95
102
|
item.addClass('active');
|
96
103
|
}
|
97
104
|
});
|
98
105
|
}
|
99
106
|
function swapChangeLinkText(link){
|
100
107
|
link.text(
|
101
|
-
link.text() == 'Change' ? '
|
108
|
+
link.text() == 'Change' ? 'Close' : 'Change'
|
102
109
|
)
|
103
110
|
}
|
111
|
+
|
104
112
|
function addThumbsToList(){
|
105
113
|
$.each(image_versions, function(i){
|
106
|
-
var listItem = $('<li><a href="javascript:;"><img
|
114
|
+
var listItem = $('<li><a href="javascript:;"><img src="' + image_versions[i]['thumb'] +'" data-image-id="' + image_versions[i]['imageId'] +'" /></a></li>');
|
107
115
|
listItem.on('click', function(){
|
116
|
+
// get the current image id
|
117
|
+
var imageid = $('img', $(this)).data('image-id');
|
108
118
|
var src = $('img', $(this)).attr('src');
|
109
|
-
|
119
|
+
|
120
|
+
// mark the current selection as active
|
121
|
+
$('li.active', thumbList).removeClass('active');
|
110
122
|
$(this).addClass('active');
|
123
|
+
|
124
|
+
// update the multi-image selector image
|
111
125
|
$(".pic.thumbnail img", panel).attr("src", src);
|
112
|
-
|
113
|
-
$(
|
114
|
-
|
115
|
-
|
126
|
+
|
127
|
+
$('[data-panel-image-pagination] [data-current-image]', panel).text(
|
128
|
+
$('li', thumbList).index($(this)) + 1
|
129
|
+
);
|
130
|
+
scrollToActiveThumb();
|
131
|
+
if (typeof clickCallback === 'function' ) {
|
132
|
+
clickCallback(image_versions[i]);
|
133
|
+
}
|
116
134
|
});
|
117
135
|
$("img", listItem).on('load', function() {
|
118
136
|
updateThumbListWidth();
|
@@ -23,8 +23,8 @@ Spotlight.onLoad(function() {
|
|
23
23
|
|
24
24
|
function success(data) {
|
25
25
|
if (data.recently_in_progress) {
|
26
|
-
monitorPanel().show();
|
27
26
|
updateMonitorPanel(data);
|
27
|
+
monitorPanel().show();
|
28
28
|
} else {
|
29
29
|
monitorPanel().hide();
|
30
30
|
}
|
@@ -48,6 +48,10 @@ Spotlight.onLoad(function() {
|
|
48
48
|
.attr('aria-valuenow', percentage)
|
49
49
|
.css('width', percentage + '%')
|
50
50
|
.text(percentage + '%');
|
51
|
+
|
52
|
+
if (data.finished) {
|
53
|
+
progressBar().removeClass('active').removeClass('progress-bar-striped');
|
54
|
+
}
|
51
55
|
}
|
52
56
|
|
53
57
|
function updatePanelErrorMessage(data) {
|
@@ -52,71 +52,57 @@ function itemsTemplate() {
|
|
52
52
|
return '<div class="autocomplete-item{{#if private}} blacklight-private{{/if}}">{{#if thumbnail}}<div class="document-thumbnail thumbnail"><img src="{{thumbnail}}" /></div>{{/if}}<span class="autocomplete-title">{{title}}</span><br/><small> {{description}}</small></div>';
|
53
53
|
}
|
54
54
|
|
55
|
-
function
|
56
|
-
if($('[data-
|
57
|
-
$('[data-
|
55
|
+
function addAutocompletetoFeaturedImage(){
|
56
|
+
if($('[data-featured-image-typeahead]').length > 0) {
|
57
|
+
$('[data-featured-image-typeahead]').spotlightSearchTypeAhead({bloodhound: itemsBloodhound(), template: itemsTemplate()}).on('click', function() {
|
58
58
|
$(this).select();
|
59
59
|
}).on('typeahead:selected typeahead:autocompleted', function(e, data) {
|
60
|
-
var remoteUrlField = $($(this).data('remoteUrlField'));
|
61
60
|
var panel = $($(this).data('target-panel'));
|
62
|
-
|
61
|
+
addImageSelector($(this), panel, data.iiif_manifest, true);
|
63
62
|
$($(this).data('id-field')).val(data['global_id']);
|
64
|
-
remoteUrlField.val(data['full_images'][0]).trigger('change');
|
65
63
|
$(this).attr('type', 'text');
|
66
|
-
$('.thumbs-list li', panel).on('click.masthead', function(){
|
67
|
-
var index = $('.thumbs-list li').index($(this));
|
68
|
-
remoteUrlField.val(data['full_images'][index]).trigger('change');
|
69
|
-
});
|
70
64
|
});
|
71
65
|
}
|
72
66
|
}
|
73
67
|
|
74
|
-
function
|
75
|
-
if(
|
76
|
-
|
77
|
-
|
78
|
-
}).on('change', function() {
|
79
|
-
$($(this).data('id-field')).val("");
|
80
|
-
}).on('typeahead:selected typeahead:autocompleted', function(e, data) {
|
81
|
-
$($(this).data('id-field')).val(data['id']);
|
82
|
-
});
|
68
|
+
function addImageSelector(input, panel, manifestUrl, initialize) {
|
69
|
+
if (!manifestUrl) {
|
70
|
+
showNonIiifAlert(input);
|
71
|
+
return;
|
83
72
|
}
|
84
|
-
|
85
|
-
|
86
|
-
function
|
87
|
-
|
88
|
-
|
89
|
-
$("[data-panel-title]", panel).text(data['title']);
|
73
|
+
var cropper = input.data('iiifCropper');
|
74
|
+
$.ajax(manifestUrl).success(
|
75
|
+
function(manifest) {
|
76
|
+
var Iiif = require('spotlight/iiif');
|
77
|
+
var iiifManifest = new Iiif(manifestUrl, manifest);
|
90
78
|
|
91
|
-
|
92
|
-
panel.addClass("blacklight-private");
|
93
|
-
}
|
79
|
+
var thumbs = iiifManifest.imagesArray();
|
94
80
|
|
95
|
-
|
96
|
-
$(input.data('id_field')).val(data['id']);
|
81
|
+
hideNonIiifAlert(input);
|
97
82
|
|
98
|
-
|
83
|
+
if (initialize) {
|
84
|
+
cropper.setIiifFields(thumbs[0]);
|
85
|
+
panel.multiImageSelector(); // Clears out existing selector
|
86
|
+
}
|
99
87
|
|
100
|
-
|
101
|
-
|
102
|
-
|
88
|
+
if(thumbs.length > 1) {
|
89
|
+
panel.show();
|
90
|
+
panel.multiImageSelector(thumbs, function(selectorImage) {
|
91
|
+
cropper.setIiifFields(selectorImage);
|
92
|
+
}, cropper.iiifImageField.val());
|
93
|
+
}
|
94
|
+
}
|
95
|
+
);
|
103
96
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
var listItem = $(this).closest('li.dd-item');
|
108
|
-
var textField = $("[data-target-panel='#" + listItem.attr('id') + "']");
|
109
|
-
$("input[type='hidden']", listItem).prop('value', '');
|
110
|
-
textField.attr('value', '');
|
111
|
-
textField.attr('type', 'text');
|
112
|
-
listItem.hide();
|
113
|
-
});
|
97
|
+
|
98
|
+
function showNonIiifAlert(input){
|
99
|
+
input.parent().prev('[data-behavior="non-iiif-alert"]').show();
|
114
100
|
}
|
115
|
-
|
116
|
-
|
101
|
+
|
102
|
+
function hideNonIiifAlert(input){
|
103
|
+
input.parent().prev('[data-behavior="non-iiif-alert"]').hide();
|
117
104
|
}
|
118
105
|
|
119
106
|
Spotlight.onLoad(function(){
|
120
107
|
addAutocompletetoFeaturedImage();
|
121
|
-
addAutocompletetoMastheadUpload();
|
122
108
|
});
|
@@ -27,8 +27,8 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
|
|
27
27
|
},
|
28
28
|
|
29
29
|
featured_pages: {
|
30
|
-
title: "
|
31
|
-
description: "This widget highlights
|
30
|
+
title: "Pages",
|
31
|
+
description: "This widget highlights pages from this exhibit. Each highlighted item links to the corresponding page."
|
32
32
|
},
|
33
33
|
|
34
34
|
resources: {
|
@@ -55,6 +55,9 @@ SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, {
|
|
55
55
|
placeholder: "Select...",
|
56
56
|
primary: "Primary caption",
|
57
57
|
secondary: "Secondary caption"
|
58
|
+
},
|
59
|
+
zpr: {
|
60
|
+
title: 'Display ZPR link'
|
58
61
|
}
|
59
62
|
},
|
60
63
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Spotlight.onLoad(function(){
|
2
|
+
$('.zpr-link').on('click', function() {
|
3
|
+
$('#ajax-modal .modal-content').html('<div id="osd-modal-container"></div>');
|
4
|
+
var controls = [
|
5
|
+
'<div class="controls">',
|
6
|
+
' <a id="osd-zoom-in"><span class="glyphicon glyphicon-plus-sign"></span></a>',
|
7
|
+
' <a id="osd-zoom-out"><span class="glyphicon glyphicon-minus-sign"></span></a>',
|
8
|
+
' <a id="osd-home"><span class="glyphicon glyphicon-resize-small"></span></a>',
|
9
|
+
' <a id="osd-full-page"><span class="glyphicon glyphicon-fullscreen"></span></a>',
|
10
|
+
'</div>'
|
11
|
+
].join("\n");
|
12
|
+
|
13
|
+
$('#osd-modal-container').append(controls);
|
14
|
+
$('#osd-modal-container').append('<div id="osd-div"></div>');
|
15
|
+
$('#osd-div').css('height', '400px');
|
16
|
+
|
17
|
+
$('#ajax-modal').modal('show');
|
18
|
+
|
19
|
+
OpenSeadragon({
|
20
|
+
id: 'osd-div',
|
21
|
+
zoomInButton: "osd-zoom-in",
|
22
|
+
zoomOutButton: "osd-zoom-out",
|
23
|
+
homeButton: "osd-home",
|
24
|
+
fullPageButton: "osd-full-page",
|
25
|
+
nextButton: "osd-next",
|
26
|
+
previousButton: "osd-previous",
|
27
|
+
tileSources: [$(this).data('iiif-tilesource')]
|
28
|
+
})
|
29
|
+
});
|
30
|
+
});
|