Skip to content

Commit

Permalink
#239 Fix the case template tasks issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 14, 2017
1 parent f591c5c commit 319641c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ui/app/scripts/controllers/admin/AdminCaseTemplatesCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
};

$scope.addTask = function() {
$scope.openTaskDialog({order: $scope.template.tasks.length}, 'Add');
var order = $scope.template.tasks ? $scope.template.tasks.length : 0;

$scope.openTaskDialog({order: order}, 'Add');
};

$scope.editTask = function(task) {
Expand Down Expand Up @@ -175,7 +177,11 @@

$scope.addTask = function() {
if(action === 'Add') {
if($scope.template.tasks) {
$scope.template.tasks.push(task);
} else {
$scope.template.tasks = [task];
}
}

$uibModalInstance.dismiss();
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/partials/admin/case-templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h4 class="vpad10 text-primary">
</div>
</div>
</div>
<div class="text-danger" ng-if="template.tasks.length === 0">
<div class="text-danger" ng-if="!template.tasks || template.tasks.length === 0">
<table class="table table-striped">
<tr>
<td>No tasks have been specified</td>
Expand Down

0 comments on commit 319641c

Please sign in to comment.