On delete roles set correctly a new role value for all membershipsd
parent
3d622e18d3
commit
119dcca961
|
@ -229,7 +229,7 @@ ProjectValuesDirective = ($log, $repo, $confirm, $location) ->
|
||||||
subtitle = value.name
|
subtitle = value.name
|
||||||
if _.keys(choices).length == 0
|
if _.keys(choices).length == 0
|
||||||
return $confirm.error("You can't delete all values.")
|
return $confirm.error("You can't delete all values.")
|
||||||
else
|
|
||||||
return $confirm.askChoice(title, subtitle, choices).then (selected) =>
|
return $confirm.askChoice(title, subtitle, choices).then (selected) =>
|
||||||
onSucces = ->
|
onSucces = ->
|
||||||
$ctrl.loadValues()
|
$ctrl.loadValues()
|
||||||
|
|
|
@ -88,8 +88,16 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
|
||||||
title = "Delete Role"
|
title = "Delete Role"
|
||||||
subtitle = @scope.role.name
|
subtitle = @scope.role.name
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then =>
|
choices = {}
|
||||||
promise = @repo.remove(@scope.role)
|
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 =>
|
promise.then =>
|
||||||
@confirm.notify('success')
|
@confirm.notify('success')
|
||||||
@.loadRoles()
|
@.loadRoles()
|
||||||
|
|
Loading…
Reference in New Issue