Skip to content

Commit

Permalink
Merge pull request #956 from jeffreycwitt/feature/collection-drag-and…
Browse files Browse the repository at this point in the history
…-drop

modified slot.js to allow for collection drag and drop
  • Loading branch information
aeschylus committed Jun 15, 2016
2 parents b1d31b3 + 8f1dc2e commit de41163
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions js/src/workspaces/slot.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@

url = url || text_url;
var manifestUrl = $.getQueryParams(url).manifest,
collectionUrl = $.getQueryParams(url).collection,
canvasId = $.getQueryParams(url).canvas,
imageInfoUrl = $.getQueryParams(url).image,
windowConfig;
Expand All @@ -171,11 +172,31 @@

_this.eventEmitter.publish('ADD_WINDOW', windowConfig);

} else if (typeof imageInfoUrl !== 'undefined') {
}

else if (typeof imageInfoUrl !== 'undefined') {
if (!_this.state.getStateProperty('manifests')[imageInfoUrl]) {
_this.eventEmitter.publish('ADD_MANIFEST_FROM_URL', imageInfoUrl, "(Added from URL)");
}
} else {
}
else if (typeof collectionUrl !== 'undefined'){
jQuery.getJSON(collectionUrl).done(function (data, status, jqXHR) {
if (data.hasOwnProperty('manifests')){
jQuery.each(data.manifests, function (ci, mfst) {
if (!_this.state.getStateProperty('manifests')[imageInfoUrl]) {
_this.eventEmitter.publish('ADD_MANIFEST_FROM_URL', mfst['@id'], "(Added from URL)");
}
});
}
});

//TODO:
//this works;
//but you might want to check if some "publish" action would be better
_this.addItem();

}
else {
if (!_this.state.getStateProperty('manifests')[imageInfoUrl]) {
_this.eventEmitter.publish('ADD_MANIFEST_FROM_URL', manifestUrl, "(Added from URL)");
}
Expand Down

0 comments on commit de41163

Please sign in to comment.