Skip to content

Commit

Permalink
Merge pull request #2435 from NCEAS/bugfix-2424-download-nested-obj
Browse files Browse the repository at this point in the history
Bugfix 2424 download nested obj
  • Loading branch information
robyngit authored Jul 18, 2024
2 parents 854b1e3 + 8cd0047 commit bcc2c7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
24 changes: 3 additions & 21 deletions src/js/views/DataItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,33 +601,15 @@ define([
this.$el.attr("data-packageId", this.dataPackageId);
}

//Download button
attributes.downloadUrl = undefined;
if (
this.model.get("dataUrl") !== undefined ||
this.model.get("url") !== undefined ||
this.model.url() !== undefined
) {
if (this.model.get("dataUrl") !== undefined) {
attributes.downloadUrl = this.model.get("dataUrl");
} else if (this.model.get("url") !== undefined) {
attributes.downloadUrl = this.model.get("url");
} else if (this.model.url() !== undefined) {
var downloadUrl = this.model.url();
attributes.downloadUrl = downloadUrl.replace(
"/meta/",
"/object/",
);
}
}
// Download button
this.downloadButtonView = new DownloadButtonView({
model: this.model,
view: "actionsView",
});
this.downloadButtonView.render();

let id = this.model.get("id");
let infoLink =
const id = this.model.get("id");
const infoLink =
MetacatUI.root +
"/view/" +
encodeURIComponent(this.currentlyViewing) +
Expand Down
4 changes: 3 additions & 1 deletion src/js/views/DataPackageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,9 @@
this.downloadButtonView.render();

// Add the downloadButtonView el to the span
this.$el.find(".downloadAction").html(this.downloadButtonView.el);
this.$el
.find(".downloadAction[data-id='" + dataPackage.id + "']")
.html(this.downloadButtonView.el);

// Filter out the packages from the member list
members = _.filter(members, function (m) {
Expand Down

0 comments on commit bcc2c7e

Please sign in to comment.