Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IIIF attribution and licence information to "Manuscript Info" sidebar #812

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default Marionette.ItemView.extend({
{
_.bindAll(this, 'propagateFolioChange', 'onViewerLoad', 'setImageURI',
'paintBoxes', 'updatePageAlias', 'gotoInputPage',
'getPageWhichMatchesAlias', 'onDocLoad', 'showPageSuggestions');
'getPageWhichMatchesAlias', 'onDocLoad', 'showPageSuggestions',
'onManifestLoad');

this.divaEventHandles = [];

Expand Down Expand Up @@ -108,6 +109,7 @@ export default Marionette.ItemView.extend({
this.onDivaEvent("ViewerDidLoad", this.propagateFolioChange);
this.onDivaEvent("VisiblePageDidChange", this.propagateFolioChange);
this.onDivaEvent("DocumentDidLoad", this.onDocLoad);
this.onDivaEvent("ManifestDidLoad", this.onManifestLoad);
},

/**
Expand Down Expand Up @@ -311,6 +313,32 @@ export default Marionette.ItemView.extend({
this.divaInstance.changeView('document');
},

/**
* Once the manifest is loaded, grab any attribution and rights information
* contained in the manifest and update the DOM to display it.
* NOTE: Diva contains a plug-in ("IIIFMetadata") that could theoretically
* be used to collect and show this data, but it errors if this data is
* improperly formatted in the IIIF, so we introduce this here to tolerate
* these cases.
* NOTE: At the moment, we only support the IIIF 2 API, since Diva only
* supports that version.
**/
onManifestLoad: function (manifest){
var attribution = manifest.attribution;
var logo = manifest.logo;
if (typeof logo === "object") {
var logo_url = logo['@id'];
} else {
var logo_url = logo;
}
var licence = manifest.license;
this.imageAttributionMetadata = {
imageAttribution: attribution,
imageLogoUrl: logo_url,
imageLicence: licence
};
},

/** Do some awkward manual manipulation of the toolbar */
_customizeToolbar: function()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export default Marionette.LayoutView.extend({

$(manuscriptInfoButton).on('click', this._showInfoSidenav.bind(this));
manuscriptInfo.appendTo(this.ui.toolbarRow.find('.diva-tools-right'));

this.model.set(divaView.imageAttributionMetadata);
});

// Initialize the search view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,27 @@ <h3 class="h4"><%- name %></h3>
<dt>Provenance</dt>
<dd><%= provenance %></dd>
<% if (description) { %>
<dt>Description</dt>
<dd><pre class="preformatted-text"><%= description %></pre></dd>
<dt>Description</dt>
<dd><pre class="preformatted-text"><%= description %></pre></dd>
<% } %>
</dl>

<% if (imageAttribution || imageLicence || imageLogoUrl) { %>
<h3 class="h4">Image Rights</h3>
<% if (imageAttribution ) { %>
<div>
<%= imageAttribution %>
</div>
<% } %>
<% if (imageLogoUrl) { %>
<div>
<img src="<%= imageLogoUrl %>" alt="Logo of the image source institution" style="max-width: 300px; max-height: 100px; margin-top: 8px; margin-bottom: 8px;"/>
</div>
<% } %>
<% if (imageLicence) { %>
<div>
<a href="<%= imageLicence %>" target="_blank">Click for licence information.</a>
</div>
<% } %>
<% } %>
</div>