Fix cases when action failed during confirm lightbox

stable
Jesús Espino 2014-09-18 16:53:21 +02:00 committed by David Barragán Merino
parent 0a2c673bb1
commit 72a54e43af
11 changed files with 19 additions and 6 deletions

View File

@ -437,6 +437,7 @@ MembershipsRowActionsDirective = ($log, $repo, $rs, $confirm) ->
$confirm.notify("success", null, "We've deleted #{subtitle}.") # TODO: i18n
onError = ->
finish(false)
# TODO: i18in
$confirm.notify("error", null, "We have not been able to delete #{subtitle}.")

View File

@ -89,6 +89,7 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading)
$rootscope.$broadcast("sprintform:remove:success")
onError = ->
finish(false)
$confirm.notify("error")
$repo.remove($scope.sprint).then(onSuccess, onError)

View File

@ -422,6 +422,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
finish()
@.loadBacklog()
promise.then null, =>
finish(false)
@confirm.notify("error")
addNewUs: (type) ->

View File

@ -138,6 +138,7 @@ class AttachmentsController extends taiga.Controller
@rootscope.$broadcast("attachment:delete")
onError = =>
finish(false)
@confirm.notify("error", null, "We have not been able to delete #{subtitle}.")
return @q.reject()

View File

@ -63,8 +63,9 @@ class ConfirmService extends taiga.Service
event.preventDefault()
target = angular.element(event.currentTarget)
@loading.start(target)
defered.resolve =>
defered.resolve (ok=true) =>
@loading.finish(target)
if ok
@.hide(el)
el.on "click.confirm-dialog", "a.button-red", (event) =>

View File

@ -135,6 +135,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
finish()
@location.path(@navUrls.resolve("project-issues", {project: @scope.project.slug}))
promise.then null, =>
finish(false)
@confirm.notify("error")
module.controller("IssueDetailController", IssueDetailController)

View File

@ -626,13 +626,15 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm) ->
$confirm.ask(title, subtitle).then (finish) ->
promise = $ctrl.deleteMyFilter(customFilterName)
promise.then ->
$ctrl.loadMyFilters().then (filters) ->
promise = $ctrl.loadMyFilters()
promise.then (filters) ->
finish()
$scope.filters.myFilters = filters
renderFilters($scope.filters.myFilters)
$ctrl.loadMyFilters().then null, ->
promise.then null, ->
finish()
promise.then null, ->
finish(false)
$confirm.notify("error")

View File

@ -136,6 +136,7 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
finish()
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
promise.then null, =>
finish(false)
@confirm.notify("error")
module.controller("TaskDetailController", TaskDetailController)

View File

@ -145,6 +145,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
finish()
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
promise.then null, =>
finish(false)
$confirm.notify("error")
module.controller("UserStoryDetailController", UserStoryDetailController)

View File

@ -147,6 +147,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
@confirm.notify("success")
onError = =>
finish(false)
@confirm.notify("error")
@repo.remove(@scope.wiki).then onSuccess, onError

View File

@ -113,12 +113,14 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls) ->
$confirm.ask(title, subtitle).then (finish) =>
promise = $tgrepo.remove($scope.wikiLinks[linkId])
promise.then ->
$ctrl.loadWikiLinks().then ->
promise = $ctrl.loadWikiLinks()
promise.then ->
finish()
render($scope.wikiLinks)
$ctrl.loadWikiLinks().then null, ->
promise.then null, ->
finish()
promise.then null, ->
finish(false)
$confirm.notify("error")
$el.on "keyup", ".new input", debounce 2000, (event) ->