diff --git a/js/src/annotations/simpleASEndpoint.js b/js/src/annotations/simpleASEndpoint.js index 854ed532d4303beb505904654f439296b3bae828..05bcf2af2a9dbb5063137853a192244944110ac8 100644 --- a/js/src/annotations/simpleASEndpoint.js +++ b/js/src/annotations/simpleASEndpoint.js @@ -151,7 +151,7 @@ $.SimpleASEndpoint = function (options) { delete annotation.fullId; delete annotation.endpoint; jQuery.ajax({ - url: _this.url + '/update/' + encodeURIComponent(annotationID) + '?APIKey=' + _this.APIKey, // this.prefix+ + url: _this.url + '/update?APIKey=' + _this.APIKey, // this.prefix+ type: 'POST', dataType: 'json', headers: { diff --git a/js/src/viewer/collectionTreeManifestsPanel.js b/js/src/viewer/collectionTreeManifestsPanel.js index 80f0c1860078bee8c5caaaed41150027794b09ca..0251e569db3dc998f424b900e1e9e90a635c62c2 100644 --- a/js/src/viewer/collectionTreeManifestsPanel.js +++ b/js/src/viewer/collectionTreeManifestsPanel.js @@ -554,7 +554,7 @@ '{{#if showURLBox}}', '<form action="" id="url-load-form">', '<label for="url-loader">{{t "addNewObject"}}:</label>', - '<input type="text" id="url-loader" name="url-load" placeholder="http://...">', + '<input type="text" id="url-loader" name="url-load" placeholder="https://...">', '<input type="submit" value="{{t "load"}}">', '</form>', '{{/if}}', diff --git a/js/src/viewer/manifestsPanel.js b/js/src/viewer/manifestsPanel.js index 8fa07eddd03ccfe310fc1d6b45172520c698eb9b..47e1c250900cbb3272b13d029bde49192ad18af5 100644 --- a/js/src/viewer/manifestsPanel.js +++ b/js/src/viewer/manifestsPanel.js @@ -55,6 +55,10 @@ _this.eventEmitter.subscribe('manifestReceived', function(event, newManifest) { _this.onManifestReceived(event, newManifest); }); + + _this.eventEmitter.subscribe('collectionReceived', function(event, newCollection) { + _this.onCollectionReceived(event, newCollection); + }); }, bindEvents: function() { @@ -139,6 +143,13 @@ appendTo: _this.manifestListElement })); _this.element.find('#manifest-search').keyup(); }, + + onCollectionReceived: function(event, newCollection) { + var _this = this; + jQuery.each(newCollection.getManifestUris(), function(_, v) { + _this.eventEmitter.publish('ADD_MANIFEST_FROM_URL', [v, newCollection.location]); + }); + }, template: $.Handlebars.compile([ '<div id="manifest-select-menu">', @@ -149,7 +160,7 @@ '{{#if showURLBox}}', '<form action="" id="url-load-form">', '<label for="url-loader">{{t "addNewObject"}}:</label>', - '<input type="text" id="url-loader" name="url-load" placeholder="http://...">', + '<input type="text" id="url-loader" name="url-load" placeholder="https://...">', '<input type="submit" value="{{t "load"}}">', '</form>', '{{/if}}', diff --git a/spec/annotations/simple-as-endpoint.test.js b/spec/annotations/simple-as-endpoint.test.js index 066b8a33a3864b2dfe9aa5e6a4bf2841ed5cb10f..56bb3dafe99abb1ba60f173e7d80a7de6b1bc3b5 100644 --- a/spec/annotations/simple-as-endpoint.test.js +++ b/spec/annotations/simple-as-endpoint.test.js @@ -134,7 +134,7 @@ describe('SimpleASEndpoint', function() { it('should run callback on success', function() { subject.update(oaAnnotation, returnSuccess, returnError); expect(jQuery.ajax).toHaveBeenCalledWith(jasmine.objectContaining({ - url: subject.url + "/update/AAA?APIKey=" + subject.APIKey, + url: subject.url + "/update?APIKey=" + subject.APIKey, type: 'POST' })); expect(returnSuccess).toHaveBeenCalled(); @@ -145,7 +145,7 @@ describe('SimpleASEndpoint', function() { ajaxSuccess = false; subject.update(oaAnnotation, returnSuccess, returnError); expect(jQuery.ajax).toHaveBeenCalledWith(jasmine.objectContaining({ - url: subject.url + "/update/AAA?APIKey=" + subject.APIKey, + url: subject.url + "/update?APIKey=" + subject.APIKey, type: 'POST' })); expect(returnSuccess).not.toHaveBeenCalled(); diff --git a/spec/viewer/manifestsPanel.test.js b/spec/viewer/manifestsPanel.test.js index ecf5071974cf659eb1cf25f28590a32fd19183d8..cee51338b71f36a855ff4f1c705f1f0876f3898e 100644 --- a/spec/viewer/manifestsPanel.test.js +++ b/spec/viewer/manifestsPanel.test.js @@ -17,12 +17,21 @@ describe('ManifestsPanel', function() { it('should listen for actions', function() { var manifest = new Mirador.Manifest(null, 'Dummy Location', this.dummyManifestContent); + var collection = new Mirador.Collection(null, 'Dummy Location', { + "@context": "http://iiif.io/api/presentation/2/context.json", + "@id": "http://example.org/iiif/collection/top", + "@type": "sc:Collection", + "label": "Top Level Collection for Example Organization" + }); spyOn(this.panel, 'onPanelVisible'); spyOn(this.panel, 'onManifestReceived'); + spyOn(this.panel, 'onCollectionReceived'); this.eventEmitter.publish('manifestsPanelVisible.set'); this.eventEmitter.publish('manifestReceived', manifest); + this.eventEmitter.publish('collectionReceived', collection, "http://example.org/iiif/collection/top") expect(this.panel.onPanelVisible).toHaveBeenCalled(); expect(this.panel.onManifestReceived).toHaveBeenCalled(); + expect(this.panel.onCollectionReceived).toHaveBeenCalled(); }); it('should bind events', function() { @@ -121,4 +130,28 @@ describe('ManifestsPanel', function() { expect(this.panel.manifestListItems.length).toBe(1); }); + it('should receive a collection and grab its manifests', function() { + spyOn(this.eventEmitter, 'publish'); + var collection = new Mirador.Collection(null, 'Digital Library @ Villanova', { + "@context": "http://iiif.io/api/presentation/2/context.json", + "@id": "http://example.org/iiif/collection/top", + "@type": "sc:Collection", + "label": "Top Level Collection for Example Organization", + "manifests": [ + { + "label": "The 'Adventurer's Oaths' from the Cardboard Drama of Esmeralda Grande", + "@id": "https://digital.library.villanova.edu/Item/vudl:2176/Manifest", + "@type": "sc:Manifest" + }, + { + "label": "The Adventures of Seumas Beg The Visit From Abroad", + "@id": "https://digital.library.villanova.edu/Item/vudl:2112/Manifest", + "@type": "sc:Manifest" + } + ] + }); + this.panel.onCollectionReceived(null, collection); + expect(this.eventEmitter.publish).toHaveBeenCalledWith('ADD_MANIFEST_FROM_URL', ["https://digital.library.villanova.edu/Item/vudl:2176/Manifest", "Digital Library @ Villanova"]); + expect(this.eventEmitter.publish).toHaveBeenCalledWith('ADD_MANIFEST_FROM_URL', ["https://digital.library.villanova.edu/Item/vudl:2112/Manifest", "Digital Library @ Villanova"]); + }) }); \ No newline at end of file