On delete roles set correctly a new role value for all membershipsd

stable
Jesús Espino 2014-08-12 17:44:57 +02:00
parent 3d622e18d3
commit 119dcca961
2 changed files with 17 additions and 9 deletions

View File

@ -229,7 +229,7 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location) ->
subtitle = value.name
if _.keys(choices).length == 0
return $confirm.error("You can't delete all values.")
else
return $confirm.askChoice(title, subtitle, choices).then (selected) =>
onSucces = ->
$ctrl.loadValues()

View File

@ -88,8 +88,16 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
title = "Delete Role"
subtitle = @scope.role.name
@confirm.ask(title, subtitle).then =>
promise = @repo.remove(@scope.role)
choices = {}
for role in @scope.roles
if role.id != @scope.role.id
choices[role.id] = role.name
if _.keys(choices).length == 0
return @confirm.error("You can't delete all values.")
return @confirm.askChoice(title, subtitle, choices).then (selected) =>
promise = @repo.remove(@scope.role, {moveTo: selected})
promise.then =>
@confirm.notify('success')
@.loadRoles()