             $el.off()
 
         submit = ->
+            currentLoading = $loading()
+                .target(submitButton)
+                .start()
+
             promise = $repo.remove($scope.user)
 
             promise.then (data) ->
+                currentLoading.finish()
                 lightboxService.close($el)
                 $auth.logout()
                 $location.path($navUrls.resolve("login"))
 
             # FIXME: error handling?
             promise.then null, ->
+                currentLoading.finish()
                 console.log "FAIL"
 
         $el.on "click", ".button-green", (event) ->

## Delete User Lightbox Directive
#############################################################################

DeleteUserDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightboxService) ->
    link = ($scope, $el, $attrs) ->
        $scope.$on "deletelightbox:new", (ctx, user)->
            lightboxService.open($el)

            event.preventDefault()
            submit()

        submitButton = $el.find(".button-red")

    return {
        link: link,
        templateUrl: "user/lightbox/lightbox-delete-account.html"
    }

module.directive("tgLbDeleteUser", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls",
                                    "lightboxService", "$tgLoading", DeleteUserDirective])
