Adding loading to milestone add
parent
5ac4769415
commit
3ad1b06a5c
|
@ -28,7 +28,7 @@ module = angular.module("taigaBacklog")
|
||||||
## Creare/Edit Sprint Lightbox Directive
|
## Creare/Edit Sprint Lightbox Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService) ->
|
CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading) ->
|
||||||
link = ($scope, $el, attrs) ->
|
link = ($scope, $el, attrs) ->
|
||||||
createSprint = true
|
createSprint = true
|
||||||
$scope.sprint = {
|
$scope.sprint = {
|
||||||
|
@ -38,7 +38,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService) ->
|
||||||
estimated_finish: null
|
estimated_finish: null
|
||||||
}
|
}
|
||||||
|
|
||||||
submit = ->
|
submit = (event) ->
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
if not form.validate()
|
if not form.validate()
|
||||||
return
|
return
|
||||||
|
@ -55,12 +55,17 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService) ->
|
||||||
newSprint.setAttr("estimated_finish", moment(newSprint.estimated_finish).format("YYYY-MM-DD"))
|
newSprint.setAttr("estimated_finish", moment(newSprint.estimated_finish).format("YYYY-MM-DD"))
|
||||||
promise = $repo.save(newSprint)
|
promise = $repo.save(newSprint)
|
||||||
|
|
||||||
|
target = angular.element(event.currentTarget)
|
||||||
|
$loading.start(target)
|
||||||
|
|
||||||
promise.then (data) ->
|
promise.then (data) ->
|
||||||
|
$loading.finish(target)
|
||||||
$scope.sprintsCounter += 1 if createSprint
|
$scope.sprintsCounter += 1 if createSprint
|
||||||
lightboxService.close($el)
|
lightboxService.close($el)
|
||||||
$rootscope.$broadcast("sprintform:create:success", data)
|
$rootscope.$broadcast("sprintform:create:success", data)
|
||||||
|
|
||||||
promise.then null, (data) ->
|
promise.then null, (data) ->
|
||||||
|
$loading.finish(target)
|
||||||
form.setErrors(data)
|
form.setErrors(data)
|
||||||
if data._error_message
|
if data._error_message
|
||||||
$confirm.notify("error", data._error_message)
|
$confirm.notify("error", data._error_message)
|
||||||
|
@ -111,7 +116,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService) ->
|
||||||
|
|
||||||
$el.on "click", ".button-green", (event) ->
|
$el.on "click", ".button-green", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
submit()
|
submit(event)
|
||||||
|
|
||||||
$el.on "click", ".delete-sprint .icon-delete", (event) ->
|
$el.on "click", ".delete-sprint .icon-delete", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -129,5 +134,6 @@ module.directive("tgLbCreateEditSprint", [
|
||||||
"$tgResources",
|
"$tgResources",
|
||||||
"$rootScope",
|
"$rootScope",
|
||||||
"lightboxService"
|
"lightboxService"
|
||||||
|
"$tgLoading"
|
||||||
CreateEditSprint
|
CreateEditSprint
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue