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