Skip to content

Commit

Permalink
add download button for entire collection
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Nov 20, 2024
1 parent 36558cf commit 3715255
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions apps/labeling/downloadTable.html
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@
document.getElementById("collectionName").innerText = collectionInfo[0].name
document.getElementById("collectionDesc").innerText = collectionInfo[0].description
}
if (collectionInfo[0].zip){
let zipButton = document.createElement("button")
zipButton.innerText = "Download Whole Collection";
zipButton.classList.add(["btn"]);
zipButton.dataset.zipurl = collectionInfo[0].zip;
zipButton.onclick = downloadCollection;
document.getElementById("collectionInfo").appendChild(zipButton)
}
// set slides
const slides = await store.findSlideLabelingStat(cid, getUserId());
if (slides && Array.isArray(slides)) {
Expand Down Expand Up @@ -450,6 +458,19 @@
}
}

async function downloadCollection(evt) {
console.log(evt)
let e = evt.target
let store = new Store("../../data/");
const zipUrl = e.dataset.zipurl;
const a = document.createElement('a');
a.href = zipUrl;
a.download = '';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}

function openGenericReview(e){
const oid = e.dataset.id;
if (oid) {
Expand Down

0 comments on commit 3715255

Please sign in to comment.