Skip to content

Commit

Permalink
Merge pull request #268 from AtlasOfLivingAustralia/feature/issue267
Browse files Browse the repository at this point in the history
Feature/issue267
  • Loading branch information
salomon-j authored Dec 19, 2024
2 parents aaf9bbd + ea8c37f commit 13b7792
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins {
}


version "7.1-SNAPSHOT"
version "7.2-SNAPSHOT"
group "org.grails.plugins"

apply plugin:"eclipse"
Expand Down
13 changes: 10 additions & 3 deletions grails-app/assets/javascripts/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,8 @@ function orEmptyArray(v) {
var parent = context.parent;
var listName = context.listName;
var modelName = context.outputModel.name;
var activityForm = context.activity && context.activity.type;
var formVersion = context.activity && context.activity.formVersion;

self.listParent = context.parent;
self.listName = listName;
Expand Down Expand Up @@ -1131,7 +1133,10 @@ function orEmptyArray(v) {
self.downloadTemplate = function () {
// Download a blank template if we are appending, otherwise download a template containing the existing data.
if (self.appendTableRows()) {
var url = config.excelOutputTemplateUrl + '?listName=' + listName + '&type=' + modelName;
var url = config.excelOutputTemplateUrl + '?listName=' + listName + '&activityForm='+activityForm+'&type=' + modelName;
if (formVersion) {
url+= '&formVersion=' + formVersion;
}
$.fileDownload(url)
.fail(function (error){
bootbox.alert('File download failed! ' + error);
Expand All @@ -1155,10 +1160,12 @@ function orEmptyArray(v) {
type: modelName,
editMode: editMode || false,
allowExtraRows: userAddedRows || false,
activityForm: activityForm,
formVersion: formVersion,
data: JSON.stringify(data)
};
var url = config.excelOutputTemplateUrl;
$.fileDownload(url, {
return $.fileDownload(url, {
httpMethod: 'POST',
data: params
});
Expand All @@ -1179,7 +1186,7 @@ function orEmptyArray(v) {
dataType: 'json',
uploadTemplateId: listName + "template-upload",
downloadTemplateId: listName + "template-download",
formData: {type: context.outputModel.name, listName: listName}
formData: {type: context.outputModel.name, listName: listName, activityForm: activityForm, formVersion: formVersion}

};
self.uploadFailed = function (message) {
Expand Down

0 comments on commit 13b7792

Please sign in to comment.