fix #1533 - when the user changes the role points in a us the popup must be updated

stable
Juanfran 2014-11-05 10:52:10 +01:00
parent 6161f7e017
commit b277fc829d
1 changed files with 13 additions and 8 deletions

View File

@ -770,15 +770,18 @@ UsPointsDirective = ($repo) ->
if numberOfRoles == 1
selectedRoleId = _.keys(us.points)[0]
roles = []
updatePointsRoles = ->
roles = _.map computableRoles, (role) ->
pointId = us.points[role.id]
pointObj = $scope.pointsById[pointId]
role = _.clone(role, true)
role.points = if pointObj.value? then pointObj.value else "?"
return role
computableRoles = _.filter($scope.project.roles, "computable")
roles = _.map computableRoles, (role) ->
pointId = us.points[role.id]
pointObj = $scope.pointsById[pointId]
role = _.clone(role, true)
role.points = if pointObj.value? then pointObj.value else "?"
return role
updatePointsRoles()
if roles.length == 0
$el.find(".icon-arrow-bottom").remove()
@ -807,6 +810,8 @@ UsPointsDirective = ($repo) ->
$el.find(".pop-points-open").popover().open()
renderRolesSelector = (us) ->
updatePointsRoles()
html = rolesTemplate({"roles": roles})
# Render into DOM and show the new created element