Skip to content

Commit

Permalink
Pass activity form name and version to table download request #267
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Dec 18, 2024
1 parent 5b35c89 commit da7ea3b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 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 Down

0 comments on commit da7ea3b

Please sign in to comment.