Fix edit us points problem (iteration 2)
parent
2661cc249e
commit
7cc25a3de6
|
@ -102,6 +102,11 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
|
|
||||||
return us
|
return us
|
||||||
|
|
||||||
|
loadTasks: ->
|
||||||
|
return @rs.tasks.list(@scope.projectId, null, @scope.usId).then (tasks) =>
|
||||||
|
@scope.tasks = tasks
|
||||||
|
return tasks
|
||||||
|
|
||||||
loadInitialData: ->
|
loadInitialData: ->
|
||||||
params = {
|
params = {
|
||||||
pslug: @params.pslug
|
pslug: @params.pslug
|
||||||
|
@ -115,8 +120,8 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
|
|
||||||
return promise.then(=> @.loadProject())
|
return promise.then(=> @.loadProject())
|
||||||
.then(=> @.loadUsersAndRoles())
|
.then(=> @.loadUsersAndRoles())
|
||||||
.then(=> @.loadUs())
|
.then(=> @q.all([@.loadUs(),
|
||||||
|
@.loadTasks()]))
|
||||||
|
|
||||||
block: ->
|
block: ->
|
||||||
@rootscope.$broadcast("block", @scope.us)
|
@rootscope.$broadcast("block", @scope.us)
|
||||||
|
@ -195,14 +200,12 @@ UsStatusDetailDirective = () ->
|
||||||
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
|
<span class="us-detail-status" style="color:<%= status.color %>"><%= status.name %></span>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<% if (showTasks) { %>
|
|
||||||
<div class="us-detail-progress-bar">
|
<div class="us-detail-progress-bar">
|
||||||
<div class="current-progress" style="width:<%- usProgress %>%"/>
|
<div class="current-progress" style="width:<%- usProgress %>%"/>
|
||||||
<span clasS="tasks-completed">
|
<span clasS="tasks-completed">
|
||||||
<%- totalClosedTasks %>/<%- totalTasks %> tasks completed
|
<%- totalClosedTasks %>/<%- totalTasks %> tasks completed
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
|
||||||
|
|
||||||
<div class="us-created-by">
|
<div class="us-created-by">
|
||||||
<div class="user-avatar">
|
<div class="user-avatar">
|
||||||
|
@ -286,13 +289,8 @@ UsStatusDetailDirective = () ->
|
||||||
val = "?" if not val?
|
val = "?" if not val?
|
||||||
v.points = val
|
v.points = val
|
||||||
|
|
||||||
if $scope.tasks
|
|
||||||
totalTasks = $scope.tasks.length
|
totalTasks = $scope.tasks.length
|
||||||
totalClosedTasks = _.filter($scope.tasks, (task) => $scope.taskStatusById[task.status].is_closed).length
|
totalClosedTasks = _.filter($scope.tasks, (task) => $scope.taskStatusById[task.status].is_closed).length
|
||||||
showTasks = true
|
|
||||||
else
|
|
||||||
showTasks = false
|
|
||||||
|
|
||||||
usProgress = 0
|
usProgress = 0
|
||||||
usProgress = 100 * totalClosedTasks / totalTasks if totalTasks > 0
|
usProgress = 100 * totalClosedTasks / totalTasks if totalTasks > 0
|
||||||
html = template({
|
html = template({
|
||||||
|
@ -304,18 +302,11 @@ UsStatusDetailDirective = () ->
|
||||||
rolePoints: rolePoints
|
rolePoints: rolePoints
|
||||||
totalTasks: totalTasks
|
totalTasks: totalTasks
|
||||||
totalClosedTasks: totalClosedTasks
|
totalClosedTasks: totalClosedTasks
|
||||||
totalTasks: totalTasks
|
|
||||||
totalClosedTasks: totalClosedTasks
|
|
||||||
showTasks: showTasks
|
|
||||||
usProgress: usProgress
|
usProgress: usProgress
|
||||||
})
|
})
|
||||||
$el.html(html)
|
$el.html(html)
|
||||||
$el.find(".status-data").append(selectionStatusTemplate({statuses:$scope.statusList}))
|
$el.find(".status-data").append(selectionStatusTemplate({statuses:$scope.statusList}))
|
||||||
|
|
||||||
$scope.$watch $attrs.ngModel, (us) ->
|
|
||||||
if us?
|
|
||||||
renderUsstatus(us)
|
|
||||||
|
|
||||||
bindOnce $scope, "tasks", (tasks) ->
|
bindOnce $scope, "tasks", (tasks) ->
|
||||||
$scope.$watch $attrs.ngModel, (us) ->
|
$scope.$watch $attrs.ngModel, (us) ->
|
||||||
if us?
|
if us?
|
||||||
|
|
Loading…
Reference in New Issue