From cc18d4ea62bcb96d4cd3c754e45e29b4482bda05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 16 Sep 2014 12:42:24 +0200 Subject: [PATCH] Fix edit us points problem --- app/coffee/modules/userstories/detail.coffee | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/coffee/modules/userstories/detail.coffee b/app/coffee/modules/userstories/detail.coffee index 66781b18..e932989f 100644 --- a/app/coffee/modules/userstories/detail.coffee +++ b/app/coffee/modules/userstories/detail.coffee @@ -117,6 +117,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin) .then(=> @.loadUsersAndRoles()) .then(=> @.loadUs()) + block: -> @rootscope.$broadcast("block", @scope.us) @@ -194,12 +195,14 @@ UsStatusDetailDirective = () -> <%= status.name %> + <% if (showTasks) { %>
<%- totalClosedTasks %>/<%- totalTasks %> tasks completed
+ <% } %>
@@ -283,8 +286,13 @@ UsStatusDetailDirective = () -> val = "?" if not val? v.points = val - totalTasks = $scope.tasks.length - totalClosedTasks = _.filter($scope.tasks, (task) => $scope.taskStatusById[task.status].is_closed).length + if $scope.tasks + totalTasks = $scope.tasks.length + totalClosedTasks = _.filter($scope.tasks, (task) => $scope.taskStatusById[task.status].is_closed).length + showTasks = true + else + showTasks = false + usProgress = 0 usProgress = 100 * totalClosedTasks / totalTasks if totalTasks > 0 html = template({ @@ -296,11 +304,18 @@ UsStatusDetailDirective = () -> rolePoints: rolePoints totalTasks: totalTasks totalClosedTasks: totalClosedTasks + totalTasks: totalTasks + totalClosedTasks: totalClosedTasks + showTasks: showTasks usProgress: usProgress }) $el.html(html) $el.find(".status-data").append(selectionStatusTemplate({statuses:$scope.statusList})) + $scope.$watch $attrs.ngModel, (us) -> + if us? + renderUsstatus(us) + bindOnce $scope, "tasks", (tasks) -> $scope.$watch $attrs.ngModel, (us) -> if us?