refresh projects list after leaving a project

stable
Juanfran 2016-03-29 08:54:13 +02:00
parent 048be8a6ee
commit 23c0e9062f
1 changed files with 6 additions and 5 deletions

View File

@ -225,7 +225,7 @@ module.directive("tgTeamMembers", TeamMembersDirective)
## Leave project Directive ## Leave project Directive
############################################################################# #############################################################################
LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate, lightboxFactory) -> LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate, lightboxFactory, currentUserService) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
leaveConfirm = () -> leaveConfirm = () ->
leave_project_text = $translate.instant("TEAM.ACTION_LEAVE_PROJECT") leave_project_text = $translate.instant("TEAM.ACTION_LEAVE_PROJECT")
@ -235,9 +235,10 @@ LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate,
promise = $rs.projects.leave($scope.project.id) promise = $rs.projects.leave($scope.project.id)
promise.then => promise.then =>
response.finish() currentUserService.loadProjects().then () ->
$confirm.notify("success") response.finish()
$location.path($navurls.resolve("home")) $confirm.notify("success")
$location.path($navurls.resolve("home"))
promise.then null, (response) -> promise.then null, (response) ->
response.finish() response.finish()
@ -263,7 +264,7 @@ LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate,
link: link link: link
} }
module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", "$translate", "tgLightboxFactory", module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", "$translate", "tgLightboxFactory", "tgCurrentUserService",
LeaveProjectDirective]) LeaveProjectDirective])