Skip to content

Commit

Permalink
modified procedure to download CO2 template file
Browse files Browse the repository at this point in the history
  • Loading branch information
lrdossan committed Sep 26, 2023
1 parent cdc2b60 commit b4bf538
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 0 additions & 14 deletions caimira/apps/calculator/static/js/co2_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,6 @@ function generateJSONStructure(endpoint, jsonData) {
}
}

// Method to download Excel template available on CERNBox
function downloadTemplate(
uri = "https://caimira-resources.web.cern.ch/CO2_template.xlsx",
filename = "CO2_template.xlsx"
) {
const link = document.createElement("a");
link.download = filename;
link.href = uri;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
delete link;
}

function insertErrorFor(referenceNode, text) {
const element = $("<span></span>")
.addClass("error_text text-danger")
Expand Down
2 changes: 1 addition & 1 deletion caimira/apps/templates/base/calculator.form.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@
<div class="modal-body">
<div class="d-flex d-row justify-content-between">
<h5 class="mt-auto mb-auto">Upload an Excel file to preview in HTML Table</h5>
<button type="button" class="btn btn-primary btn-sm" onclick="downloadTemplate()">Download template</button>
<a class="btn btn-primary btn-sm" href="https://caimira-resources.web.cern.ch/CO2_template.xlsx">Download template</a>
</div>
<br>
<!-- Input element to upload an excel file -->
Expand Down

0 comments on commit b4bf538

Please sign in to comment.