Skip to content
Snippets Groups Projects
Unverified Commit 93445b6a authored by aeschylus's avatar aeschylus Committed by GitHub
Browse files

Merge pull request #1507 from dicksonlaw583/fix-1506

Add back manifest support for collectionUri on the classic manifests panel
parents 255aff18 287e7ef2
No related branches found
No related tags found
No related merge requests found
...@@ -55,6 +55,10 @@ ...@@ -55,6 +55,10 @@
_this.eventEmitter.subscribe('manifestReceived', function(event, newManifest) { _this.eventEmitter.subscribe('manifestReceived', function(event, newManifest) {
_this.onManifestReceived(event, newManifest); _this.onManifestReceived(event, newManifest);
}); });
_this.eventEmitter.subscribe('collectionReceived', function(event, newCollection) {
_this.onCollectionReceived(event, newCollection);
});
}, },
bindEvents: function() { bindEvents: function() {
...@@ -140,6 +144,13 @@ ...@@ -140,6 +144,13 @@
_this.element.find('#manifest-search').keyup(); _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([ template: $.Handlebars.compile([
'<div id="manifest-select-menu">', '<div id="manifest-select-menu">',
'<div class="container">', '<div class="container">',
......
...@@ -17,12 +17,21 @@ describe('ManifestsPanel', function() { ...@@ -17,12 +17,21 @@ describe('ManifestsPanel', function() {
it('should listen for actions', function() { it('should listen for actions', function() {
var manifest = new Mirador.Manifest(null, 'Dummy Location', this.dummyManifestContent); 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, 'onPanelVisible');
spyOn(this.panel, 'onManifestReceived'); spyOn(this.panel, 'onManifestReceived');
spyOn(this.panel, 'onCollectionReceived');
this.eventEmitter.publish('manifestsPanelVisible.set'); this.eventEmitter.publish('manifestsPanelVisible.set');
this.eventEmitter.publish('manifestReceived', manifest); this.eventEmitter.publish('manifestReceived', manifest);
this.eventEmitter.publish('collectionReceived', collection, "http://example.org/iiif/collection/top")
expect(this.panel.onPanelVisible).toHaveBeenCalled(); expect(this.panel.onPanelVisible).toHaveBeenCalled();
expect(this.panel.onManifestReceived).toHaveBeenCalled(); expect(this.panel.onManifestReceived).toHaveBeenCalled();
expect(this.panel.onCollectionReceived).toHaveBeenCalled();
}); });
it('should bind events', function() { it('should bind events', function() {
...@@ -121,4 +130,28 @@ describe('ManifestsPanel', function() { ...@@ -121,4 +130,28 @@ describe('ManifestsPanel', function() {
expect(this.panel.manifestListItems.length).toBe(1); 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment