Fixing project renaming and deleting

stable
Alejandro Alonso 2015-04-27 08:26:39 +02:00 committed by Juanfran
parent dab4bc9a95
commit 3b95376686
2 changed files with 6 additions and 5 deletions

View File

@ -106,7 +106,7 @@ module.controller("ProjectProfileController", ProjectProfileController)
## Project Profile Directive ## Project Profile Directive
############################################################################# #############################################################################
ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location) -> ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location, projectsService) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
form = $el.find("form").checksley({"onlyOneErrorElement": true}) form = $el.find("form").checksley({"onlyOneErrorElement": true})
submit = debounce 2000, (event) => submit = debounce 2000, (event) =>
@ -123,6 +123,7 @@ ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location) ->
newUrl = $navurls.resolve("project-admin-project-profile-details", {project: $scope.project.slug}) newUrl = $navurls.resolve("project-admin-project-profile-details", {project: $scope.project.slug})
$location.path(newUrl) $location.path(newUrl)
$scope.$emit("project:loaded", $scope.project) $scope.$emit("project:loaded", $scope.project)
projectsService.fetchProjects()
promise.then null, (data) -> promise.then null, (data) ->
$loading.finish(submitButton) $loading.finish(submitButton)
@ -136,8 +137,7 @@ ProjectProfileDirective = ($repo, $confirm, $loading, $navurls, $location) ->
return {link:link} return {link:link}
module.directive("tgProjectProfile", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgNavUrls", "$tgLocation", module.directive("tgProjectProfile", ["$tgRepo", "$tgConfirm", "$tgLoading", "$tgNavUrls", "$tgLocation", "tgProjects", ProjectProfileDirective])
ProjectProfileDirective])
############################################################################# #############################################################################
## Project Default Values Directive ## Project Default Values Directive

View File

@ -150,7 +150,7 @@ module.directive("tgLbCreateProject", ["$rootScope", "$tgRepo", "$tgConfirm",
## Delete Project Lightbox Directive ## Delete Project Lightbox Directive
############################################################################# #############################################################################
DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader) -> DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confirm, lightboxService, tgLoader, projectsService) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
projectToDelete = null projectToDelete = null
$scope.$on "deletelightbox:new", (ctx, project)-> $scope.$on "deletelightbox:new", (ctx, project)->
@ -171,6 +171,7 @@ DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confir
$rootscope.$broadcast("projects:reload") $rootscope.$broadcast("projects:reload")
$location.path($navUrls.resolve("home")) $location.path($navUrls.resolve("home"))
$confirm.notify("success") $confirm.notify("success")
projectsService.fetchProjects()
# FIXME: error handling? # FIXME: error handling?
promise.then null, -> promise.then null, ->
@ -188,4 +189,4 @@ DeleteProjectDirective = ($repo, $rootscope, $auth, $location, $navUrls, $confir
return {link:link} return {link:link}
module.directive("tgLbDeleteProject", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls", module.directive("tgLbDeleteProject", ["$tgRepo", "$rootScope", "$tgAuth", "$tgLocation", "$tgNavUrls",
"$tgConfirm", "lightboxService", "tgLoader", DeleteProjectDirective]) "$tgConfirm", "lightboxService", "tgLoader", "tgProjects", DeleteProjectDirective])