Skip to content

Commit

Permalink
Merge pull request #807 from AtlasOfLivingAustralia/feature/#800_1
Browse files Browse the repository at this point in the history
#800_1 : fix category option issue
  • Loading branch information
temi authored Nov 30, 2023
2 parents 580ae4c + a5bf33d commit 6427066
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ <h4 class="modal-title">Add an attachment</h4>
<label for="category" class="col-sm-3 control-label">Category</label>

<div class="col-sm-9">
<select id="category" ng-model="attachmentUploadCtrl.metadata.category"
ng-options="category.key as category.value for category in attachmentUploadCtrl.categories" class="form-control">
<select id="category" ng-model="attachmentUploadCtrl.metadata.category" class="form-control">
<option value="">Select a category</option>
<option ng-repeat="category in attachmentUploadCtrl.categories | orderBy:'toString()'" value="{{category.key}}"
ng-selected="attachmentUploadCtrl.metadata.category == category.key">{{category.key}}</option>
</select>
</div>
</div>
Expand Down

0 comments on commit 6427066

Please sign in to comment.