Fix edit us points problem

stable
Jesús Espino 2014-09-16 12:42:24 +02:00
parent 660e89a519
commit cc18d4ea62
1 changed files with 17 additions and 2 deletions

View File

@ -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 = () ->
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
</h1>
<% if (showTasks) { %>
<div class="us-detail-progress-bar">
<div class="current-progress" style="width:<%- usProgress %>%"/>
<span clasS="tasks-completed">
<%- totalClosedTasks %>/<%- totalTasks %> tasks completed
</span>
</div>
<% } %>
<div class="us-created-by">
<div class="user-avatar">
@ -283,8 +286,13 @@ UsStatusDetailDirective = () ->
val = "?" if not val?
v.points = val
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?