Skip to content

Commit

Permalink
Merge pull request #680 from ubc/fix-save-draft
Browse files Browse the repository at this point in the history
Fix attachment not shown when saving draft twice
  • Loading branch information
andrew-gardener authored Jan 30, 2018
2 parents 8c87e77 + 50c5431 commit 8b1b74f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compair/static/modules/answer/answer-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,13 @@ module.controller(

if (ret.draft) {
Toaster.success("Answer Draft Saved", "Remember to submit your answer before the deadline.");
$location.path('/course/' + $scope.courseId + '/assignment/' + $scope.assignmentId + '/answer/' + $scope.answer.id + '/edit');
$location.replace();
var newPath = '/course/' + $scope.courseId + '/assignment/' + $scope.assignmentId + '/answer/' + $scope.answer.id + '/edit';
if ($location.path() == newPath) {
$route.reload();
} else {
$location.path(newPath);
$location.replace();
}
} else {
Toaster.success("Answer Submitted");
$location.path('/course/' + $scope.courseId + '/assignment/' +$scope.assignmentId);
Expand Down

0 comments on commit 8b1b74f

Please sign in to comment.