loading while deleting user
parent
ba86d707bd
commit
5cd58d1207
|
@ -33,7 +33,7 @@ module = angular.module("taigaUserSettings")
|
||||||
## Delete User Lightbox Directive
|
## Delete User Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
DeleteUserDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightboxService) ->
|
DeleteUserDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightboxService, $loading) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$scope.$on "deletelightbox:new", (ctx, user)->
|
$scope.$on "deletelightbox:new", (ctx, user)->
|
||||||
lightboxService.open($el)
|
lightboxService.open($el)
|
||||||
|
@ -42,15 +42,21 @@ DeleteUserDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightboxSe
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
submit = ->
|
submit = ->
|
||||||
|
currentLoading = $loading()
|
||||||
|
.target(submitButton)
|
||||||
|
.start()
|
||||||
|
|
||||||
promise = $repo.remove($scope.user)
|
promise = $repo.remove($scope.user)
|
||||||
|
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
|
currentLoading.finish()
|
||||||
lightboxService.close($el)
|
lightboxService.close($el)
|
||||||
$auth.logout()
|
$auth.logout()
|
||||||
$location.path($navUrls.resolve("login"))
|
$location.path($navUrls.resolve("login"))
|
||||||
|
|
||||||
# FIXME: error handling?
|
# FIXME: error handling?
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
|
currentLoading.finish()
|
||||||
console.log "FAIL"
|
console.log "FAIL"
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
|
@ -61,10 +67,12 @@ DeleteUserDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightboxSe
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
submit()
|
submit()
|
||||||
|
|
||||||
|
submitButton = $el.find(".button-red")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
link: link,
|
link: link,
|
||||||
templateUrl: "user/lightbox/lightbox-delete-account.html"
|
templateUrl: "user/lightbox/lightbox-delete-account.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
module.directive("tgLbDeleteUser", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls",
|
module.directive("tgLbDeleteUser", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls",
|
||||||
"lightboxService", DeleteUserDirective])
|
"lightboxService", "$tgLoading", DeleteUserDirective])
|
||||||
|
|
Loading…
Reference in New Issue