From a5bf33d266adaf5d7c49a0bd7c5328d23f2b5b13 Mon Sep 17 00:00:00 2001 From: steven choi Date: Thu, 30 Nov 2023 15:57:12 +1100 Subject: [PATCH] #800_1 : fix category option issue --- .../profileEditor/controllers/AttachmentController.js | 6 +++++- .../profileEditor/templates/attachmentUpload.tpl.htm | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/grails-app/assets/javascripts/profileEditor/controllers/AttachmentController.js b/grails-app/assets/javascripts/profileEditor/controllers/AttachmentController.js index 5ab2a83a..df1e99a2 100644 --- a/grails-app/assets/javascripts/profileEditor/controllers/AttachmentController.js +++ b/grails-app/assets/javascripts/profileEditor/controllers/AttachmentController.js @@ -91,13 +91,17 @@ profileEditor.controller("AttachmentUploadController", function (profileService, var pdfType = {key: "PDF", title: "PDF Document"}; self.types = [pdfType, urlType]; + self.metadata = angular.isDefined(attachment) ? _.clone(attachment) : {}; + if (self.categories == null) { profileService.getCategories().then(function (data) { self.categories = data.resp; + if (self.metadata.category == null) { + self.metadata.category = self.categories[0].value; + } }); } - self.metadata = angular.isDefined(attachment) ? _.clone(attachment) : {}; self.files = null; self.error = null; self.type = angular.isDefined(attachment.url) && attachment.url ? urlType.key : pdfType.key; diff --git a/grails-app/assets/javascripts/profileEditor/templates/attachmentUpload.tpl.htm b/grails-app/assets/javascripts/profileEditor/templates/attachmentUpload.tpl.htm index 2bda87b4..c07dcea5 100644 --- a/grails-app/assets/javascripts/profileEditor/templates/attachmentUpload.tpl.htm +++ b/grails-app/assets/javascripts/profileEditor/templates/attachmentUpload.tpl.htm @@ -82,9 +82,10 @@
- +