commit
b77faa1c20
|
@ -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}.")
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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) ->
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -44,53 +44,53 @@ class ConfirmService extends taiga.Service
|
|||
constructor: (@q, @lightboxService, @loading) ->
|
||||
_.bindAll(@)
|
||||
|
||||
hide: ->
|
||||
if @.el
|
||||
@lightboxService.close(@.el)
|
||||
hide: (el)->
|
||||
if el
|
||||
@lightboxService.close(el)
|
||||
|
||||
@.el.off(".confirm-dialog")
|
||||
delete @.el
|
||||
el.off(".confirm-dialog")
|
||||
|
||||
ask: (title, subtitle, lightboxSelector=".lightbox_confirm-delete") ->
|
||||
@.el = angular.element(lightboxSelector)
|
||||
el = angular.element(lightboxSelector)
|
||||
|
||||
# Render content
|
||||
@.el.find("h2.title").html(title)
|
||||
@.el.find("span.subtitle").html(subtitle)
|
||||
el.find("h2.title").html(title)
|
||||
el.find("span.subtitle").html(subtitle)
|
||||
defered = @q.defer()
|
||||
|
||||
# Assign event handlers
|
||||
@.el.on "click.confirm-dialog", "a.button-green", debounce 2000, (event) =>
|
||||
el.on "click.confirm-dialog", "a.button-green", debounce 2000, (event) =>
|
||||
event.preventDefault()
|
||||
target = angular.element(event.currentTarget)
|
||||
@loading.start(target)
|
||||
defered.resolve =>
|
||||
defered.resolve (ok=true) =>
|
||||
@loading.finish(target)
|
||||
@.hide()
|
||||
if ok
|
||||
@.hide(el)
|
||||
|
||||
@.el.on "click.confirm-dialog", "a.button-red", (event) =>
|
||||
el.on "click.confirm-dialog", "a.button-red", (event) =>
|
||||
event.preventDefault()
|
||||
defered.reject()
|
||||
@.hide()
|
||||
@.hide(el)
|
||||
|
||||
@lightboxService.open(@.el)
|
||||
@lightboxService.open(el)
|
||||
|
||||
return defered.promise
|
||||
|
||||
askChoice: (title, subtitle, choices, lightboxSelector=".lightbox-ask-choice") ->
|
||||
@.el = angular.element(lightboxSelector)
|
||||
el = angular.element(lightboxSelector)
|
||||
|
||||
# Render content
|
||||
@.el.find("h2.title").html(title)
|
||||
@.el.find("span.subtitle").html(subtitle)
|
||||
choicesField = @.el.find("select.choices")
|
||||
el.find("h2.title").html(title)
|
||||
el.find("span.subtitle").html(subtitle)
|
||||
choicesField = el.find("select.choices")
|
||||
choicesField.html('')
|
||||
_.each choices, (value, key) ->
|
||||
choicesField.append(angular.element("<option value='#{key}'>#{value}</option>"))
|
||||
defered = @q.defer()
|
||||
|
||||
# Assign event handlers
|
||||
@.el.on "click.confirm-dialog", "a.button-green", debounce 2000, (event) =>
|
||||
el.on "click.confirm-dialog", "a.button-green", debounce 2000, (event) =>
|
||||
event.preventDefault()
|
||||
target = angular.element(event.currentTarget)
|
||||
@loading.start(target)
|
||||
|
@ -98,59 +98,59 @@ class ConfirmService extends taiga.Service
|
|||
selected: choicesField.val()
|
||||
finish: =>
|
||||
@loading.finish(target)
|
||||
@.hide()
|
||||
@.hide(el)
|
||||
}
|
||||
|
||||
@.el.on "click.confirm-dialog", "a.button-red", (event) =>
|
||||
el.on "click.confirm-dialog", "a.button-red", (event) =>
|
||||
event.preventDefault()
|
||||
defered.reject()
|
||||
@.hide()
|
||||
@.hide(el)
|
||||
|
||||
@lightboxService.open(@.el)
|
||||
@lightboxService.open(el)
|
||||
|
||||
return defered.promise
|
||||
|
||||
error: (message) ->
|
||||
@.el = angular.element(".lightbox-generic-error")
|
||||
el = angular.element(".lightbox-generic-error")
|
||||
|
||||
# Render content
|
||||
@.el.find("h2.title").html(message)
|
||||
el.find("h2.title").html(message)
|
||||
defered = @q.defer()
|
||||
|
||||
# Assign event handlers
|
||||
@.el.on "click.confirm-dialog", "a.button-green", (event) =>
|
||||
el.on "click.confirm-dialog", "a.button-green", (event) =>
|
||||
event.preventDefault()
|
||||
defered.resolve()
|
||||
@.hide()
|
||||
@.hide(el)
|
||||
|
||||
@.el.on "click.confirm-dialog", "a.close", (event) =>
|
||||
el.on "click.confirm-dialog", "a.close", (event) =>
|
||||
event.preventDefault()
|
||||
defered.resolve()
|
||||
@.hide()
|
||||
@.hide(el)
|
||||
|
||||
@lightboxService.open(@.el)
|
||||
@lightboxService.open(el)
|
||||
|
||||
return defered.promise
|
||||
|
||||
success: (message) ->
|
||||
@.el = angular.element(".lightbox-generic-success")
|
||||
el = angular.element(".lightbox-generic-success")
|
||||
|
||||
# Render content
|
||||
@.el.find("h2.title").html(message)
|
||||
el.find("h2.title").html(message)
|
||||
defered = @q.defer()
|
||||
|
||||
# Assign event handlers
|
||||
@.el.on "click.confirm-dialog", "a.button-green", (event) =>
|
||||
el.on "click.confirm-dialog", "a.button-green", (event) =>
|
||||
event.preventDefault()
|
||||
defered.resolve()
|
||||
@.hide()
|
||||
@.hide(el)
|
||||
|
||||
@.el.on "click.confirm-dialog", "a.close", (event) =>
|
||||
el.on "click.confirm-dialog", "a.close", (event) =>
|
||||
event.preventDefault()
|
||||
defered.resolve()
|
||||
@.hide()
|
||||
@.hide(el)
|
||||
|
||||
@lightboxService.open(@.el)
|
||||
@lightboxService.open(el)
|
||||
|
||||
return defered.promise
|
||||
|
||||
|
@ -160,17 +160,17 @@ class ConfirmService extends taiga.Service
|
|||
# Add default texts to NOTIFICATION_MSG for new notification types
|
||||
|
||||
selector = ".notification-message-#{type}"
|
||||
@.el = angular.element(selector)
|
||||
el = angular.element(selector)
|
||||
|
||||
if title
|
||||
@.el.find("h4").html(title)
|
||||
el.find("h4").html(title)
|
||||
else
|
||||
@.el.find("h4").html(NOTIFICATION_MSG[type].title)
|
||||
el.find("h4").html(NOTIFICATION_MSG[type].title)
|
||||
|
||||
if message
|
||||
@.el.find("p").html(message)
|
||||
el.find("p").html(message)
|
||||
else
|
||||
@.el.find("p").html(NOTIFICATION_MSG[type].message)
|
||||
el.find("p").html(NOTIFICATION_MSG[type].message)
|
||||
|
||||
body = angular.element("body")
|
||||
body.find(".notification-message .notification-light")
|
||||
|
@ -193,11 +193,11 @@ class ConfirmService extends taiga.Service
|
|||
|
||||
delete @.tsem
|
||||
|
||||
@.el.on "click", ".icon-delete", (event) =>
|
||||
el.on "click", ".icon-delete", (event) =>
|
||||
body.find(selector)
|
||||
.removeClass('active')
|
||||
.addClass('inactive')
|
||||
|
||||
|
||||
module = angular.module("taigaBase")
|
||||
module = angular.module("taigaCommon")
|
||||
module.service("$tgConfirm", ConfirmService)
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) ->
|
||||
|
|
Loading…
Reference in New Issue