diff --git a/src/main/webapp/app/controllers/submission/submissionViewController.js b/src/main/webapp/app/controllers/submission/submissionViewController.js index 8110ea02f..b23bf1a6a 100644 --- a/src/main/webapp/app/controllers/submission/submissionViewController.js +++ b/src/main/webapp/app/controllers/submission/submissionViewController.js @@ -1,4 +1,4 @@ -vireo.controller("SubmissionViewController", function ($controller, $q, $scope, $routeParams, CustomActionDefinitionRepo, EmbargoRepo, FieldPredicateRepo, FileUploadService, StudentSubmissionRepo, SubmissionStates) { +vireo.controller("SubmissionViewController", function ($controller, $q, $routeParams, $scope, $timeout, CustomActionDefinitionRepo, EmbargoRepo, FieldPredicateRepo, FileUploadService, StudentSubmissionRepo, SubmissionStates) { angular.extend(this, $controller('AbstractController', { $scope: $scope @@ -12,6 +12,9 @@ vireo.controller("SubmissionViewController", function ($controller, $q, $scope, $scope.actionLogDelay = 2000; + $scope.fieldProfile = undefined; + $scope.fieldPredicate = undefined; + FieldPredicateRepo.ready().then(function() { var deleteFile = function (fieldValue) { @@ -31,6 +34,11 @@ vireo.controller("SubmissionViewController", function ($controller, $q, $scope, StudentSubmissionRepo.fetchSubmissionById($routeParams.submissionId).then(function (submission) { if (refreshScope) { $scope.submission = submission; + + $scope.fieldProfile = undefined; + $timeout(function () { + $scope.onSelectDocumentType($scope.fieldPredicate); + }); } else { angular.extend($scope.submission, submission); } @@ -49,6 +57,13 @@ vireo.controller("SubmissionViewController", function ($controller, $q, $scope, $scope.archivingManuscript = false; + $scope.onSelectDocumentType = function (fieldPredicate) { + if (!!fieldPredicate && !!fieldPredicate.id) { + $scope.fieldPredicate = fieldPredicate; + $scope.fieldProfile = $scope.submission.getFieldProfileByPredicate(fieldPredicate); + } + }; + $scope.addMessage = function () { $scope.messaging = true; $scope.submission.addMessage($scope.message).then(function () { @@ -99,7 +114,7 @@ vireo.controller("SubmissionViewController", function ($controller, $q, $scope, } $q.all(removePromises).then(function (removeFiles) { if (removeFiles.every(Boolean)) { - fetchSubmission(); + fetchSubmission(true); } else { console.error('Failed to remove additional files. Please refresh the page.'); } diff --git a/src/main/webapp/app/views/submission/submissionView.html b/src/main/webapp/app/views/submission/submissionView.html index 6ecd316bd..f215061b9 100644 --- a/src/main/webapp/app/views/submission/submissionView.html +++ b/src/main/webapp/app/views/submission/submissionView.html @@ -77,7 +77,7 @@

Upload/Remove Files