Adding more error control to sprint creation

stable
Alejandro Alonso 2014-06-26 16:59:19 +02:00
parent 439939faf3
commit 6548576ad9
1 changed files with 5 additions and 1 deletions

View File

@ -172,10 +172,14 @@ CreateSprint = ($repo, $rs, $rootscope) ->
if not form.validate() if not form.validate()
return return
$repo.create("milestones", $scope.sprint).then (data) -> promise = $repo.create("milestones", $scope.sprint)
promise.then (data) ->
$el.addClass("hidden") $el.addClass("hidden")
$rootscope.$broadcast("sprintform:create:success", data) $rootscope.$broadcast("sprintform:create:success", data)
promise.then null, (data) ->
form.setErrors(data)
$scope.$on "sprintform:create", -> $scope.$on "sprintform:create", ->
$el.removeClass("hidden") $el.removeClass("hidden")
$scope.sprint = { $scope.sprint = {