Fix #1067: When delete a project reload nav menu
parent
893b01a2c9
commit
a209d6b2cf
|
@ -34,10 +34,10 @@ CreateProject = ($rootscope, $repo, $confirm, $location, $navurls, $rs, $project
|
||||||
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
form = $el.find("form").checksley({"onlyOneErrorElement": true})
|
||||||
|
|
||||||
onSuccessSubmit = (response) ->
|
onSuccessSubmit = (response) ->
|
||||||
lightboxService.close($el)
|
$rootscope.$broadcast("projects:reload")
|
||||||
$confirm.notify("success", "Success") #TODO: i18n
|
$confirm.notify("success", "Success") #TODO: i18n
|
||||||
$location.url($projectUrl.get(response))
|
$location.url($projectUrl.get(response))
|
||||||
$rootscope.$broadcast("projects:reload")
|
lightboxService.close($el)
|
||||||
|
|
||||||
onErrorSubmit = (response) ->
|
onErrorSubmit = (response) ->
|
||||||
form.setErrors(response)
|
form.setErrors(response)
|
||||||
|
@ -124,7 +124,7 @@ module.directive("tgLbCreateProject", ["$rootScope", "$tgRepo", "$tgConfirm", "$
|
||||||
## Delete Project Lightbox Directive
|
## Delete Project Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightboxService) ->
|
DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
projectToDelete = null
|
projectToDelete = null
|
||||||
$scope.$on "deletelightbox:new", (ctx, project)->
|
$scope.$on "deletelightbox:new", (ctx, project)->
|
||||||
|
@ -139,11 +139,14 @@ DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightbo
|
||||||
|
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
lightboxService.close($el)
|
lightboxService.close($el)
|
||||||
|
$rootscope.$broadcast("projects:reload")
|
||||||
$location.path($navUrls.resolve("home"))
|
$location.path($navUrls.resolve("home"))
|
||||||
|
$confirm.notify("success")
|
||||||
|
|
||||||
# FIXME: error handling?
|
# FIXME: error handling?
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
console.log "FAIL"
|
$confirm.notify("error")
|
||||||
|
lightboxService.close($el)
|
||||||
|
|
||||||
$el.on "click", ".button-red", (event) ->
|
$el.on "click", ".button-red", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -156,4 +159,4 @@ DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, lightbo
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgLbDeleteProject", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls",
|
module.directive("tgLbDeleteProject", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls",
|
||||||
"lightboxService", DeleteProjectDirective])
|
"$tgConfirm", "lightboxService", DeleteProjectDirective])
|
||||||
|
|
Loading…
Reference in New Issue