commit
b77faa1c20
|
@ -437,6 +437,7 @@ MembershipsRowActionsDirective = ($log, $repo, $rs, $confirm) ->
|
||||||
$confirm.notify("success", null, "We've deleted #{subtitle}.") # TODO: i18n
|
$confirm.notify("success", null, "We've deleted #{subtitle}.") # TODO: i18n
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
|
finish(false)
|
||||||
# TODO: i18in
|
# TODO: i18in
|
||||||
$confirm.notify("error", null, "We have not been able to delete #{subtitle}.")
|
$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")
|
$rootscope.$broadcast("sprintform:remove:success")
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
|
finish(false)
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
$repo.remove($scope.sprint).then(onSuccess, onError)
|
$repo.remove($scope.sprint).then(onSuccess, onError)
|
||||||
|
|
||||||
|
|
|
@ -422,6 +422,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
finish()
|
finish()
|
||||||
@.loadBacklog()
|
@.loadBacklog()
|
||||||
promise.then null, =>
|
promise.then null, =>
|
||||||
|
finish(false)
|
||||||
@confirm.notify("error")
|
@confirm.notify("error")
|
||||||
|
|
||||||
addNewUs: (type) ->
|
addNewUs: (type) ->
|
||||||
|
|
|
@ -138,6 +138,7 @@ class AttachmentsController extends taiga.Controller
|
||||||
@rootscope.$broadcast("attachment:delete")
|
@rootscope.$broadcast("attachment:delete")
|
||||||
|
|
||||||
onError = =>
|
onError = =>
|
||||||
|
finish(false)
|
||||||
@confirm.notify("error", null, "We have not been able to delete #{subtitle}.")
|
@confirm.notify("error", null, "We have not been able to delete #{subtitle}.")
|
||||||
return @q.reject()
|
return @q.reject()
|
||||||
|
|
||||||
|
|
|
@ -44,53 +44,53 @@ class ConfirmService extends taiga.Service
|
||||||
constructor: (@q, @lightboxService, @loading) ->
|
constructor: (@q, @lightboxService, @loading) ->
|
||||||
_.bindAll(@)
|
_.bindAll(@)
|
||||||
|
|
||||||
hide: ->
|
hide: (el)->
|
||||||
if @.el
|
if el
|
||||||
@lightboxService.close(@.el)
|
@lightboxService.close(el)
|
||||||
|
|
||||||
@.el.off(".confirm-dialog")
|
el.off(".confirm-dialog")
|
||||||
delete @.el
|
|
||||||
|
|
||||||
ask: (title, subtitle, lightboxSelector=".lightbox_confirm-delete") ->
|
ask: (title, subtitle, lightboxSelector=".lightbox_confirm-delete") ->
|
||||||
@.el = angular.element(lightboxSelector)
|
el = angular.element(lightboxSelector)
|
||||||
|
|
||||||
# Render content
|
# Render content
|
||||||
@.el.find("h2.title").html(title)
|
el.find("h2.title").html(title)
|
||||||
@.el.find("span.subtitle").html(subtitle)
|
el.find("span.subtitle").html(subtitle)
|
||||||
defered = @q.defer()
|
defered = @q.defer()
|
||||||
|
|
||||||
# Assign event handlers
|
# 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()
|
event.preventDefault()
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
@loading.start(target)
|
@loading.start(target)
|
||||||
defered.resolve =>
|
defered.resolve (ok=true) =>
|
||||||
@loading.finish(target)
|
@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()
|
event.preventDefault()
|
||||||
defered.reject()
|
defered.reject()
|
||||||
@.hide()
|
@.hide(el)
|
||||||
|
|
||||||
@lightboxService.open(@.el)
|
@lightboxService.open(el)
|
||||||
|
|
||||||
return defered.promise
|
return defered.promise
|
||||||
|
|
||||||
askChoice: (title, subtitle, choices, lightboxSelector=".lightbox-ask-choice") ->
|
askChoice: (title, subtitle, choices, lightboxSelector=".lightbox-ask-choice") ->
|
||||||
@.el = angular.element(lightboxSelector)
|
el = angular.element(lightboxSelector)
|
||||||
|
|
||||||
# Render content
|
# Render content
|
||||||
@.el.find("h2.title").html(title)
|
el.find("h2.title").html(title)
|
||||||
@.el.find("span.subtitle").html(subtitle)
|
el.find("span.subtitle").html(subtitle)
|
||||||
choicesField = @.el.find("select.choices")
|
choicesField = el.find("select.choices")
|
||||||
choicesField.html('')
|
choicesField.html('')
|
||||||
_.each choices, (value, key) ->
|
_.each choices, (value, key) ->
|
||||||
choicesField.append(angular.element("<option value='#{key}'>#{value}</option>"))
|
choicesField.append(angular.element("<option value='#{key}'>#{value}</option>"))
|
||||||
defered = @q.defer()
|
defered = @q.defer()
|
||||||
|
|
||||||
# Assign event handlers
|
# 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()
|
event.preventDefault()
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
@loading.start(target)
|
@loading.start(target)
|
||||||
|
@ -98,59 +98,59 @@ class ConfirmService extends taiga.Service
|
||||||
selected: choicesField.val()
|
selected: choicesField.val()
|
||||||
finish: =>
|
finish: =>
|
||||||
@loading.finish(target)
|
@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()
|
event.preventDefault()
|
||||||
defered.reject()
|
defered.reject()
|
||||||
@.hide()
|
@.hide(el)
|
||||||
|
|
||||||
@lightboxService.open(@.el)
|
@lightboxService.open(el)
|
||||||
|
|
||||||
return defered.promise
|
return defered.promise
|
||||||
|
|
||||||
error: (message) ->
|
error: (message) ->
|
||||||
@.el = angular.element(".lightbox-generic-error")
|
el = angular.element(".lightbox-generic-error")
|
||||||
|
|
||||||
# Render content
|
# Render content
|
||||||
@.el.find("h2.title").html(message)
|
el.find("h2.title").html(message)
|
||||||
defered = @q.defer()
|
defered = @q.defer()
|
||||||
|
|
||||||
# Assign event handlers
|
# Assign event handlers
|
||||||
@.el.on "click.confirm-dialog", "a.button-green", (event) =>
|
el.on "click.confirm-dialog", "a.button-green", (event) =>
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
defered.resolve()
|
defered.resolve()
|
||||||
@.hide()
|
@.hide(el)
|
||||||
|
|
||||||
@.el.on "click.confirm-dialog", "a.close", (event) =>
|
el.on "click.confirm-dialog", "a.close", (event) =>
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
defered.resolve()
|
defered.resolve()
|
||||||
@.hide()
|
@.hide(el)
|
||||||
|
|
||||||
@lightboxService.open(@.el)
|
@lightboxService.open(el)
|
||||||
|
|
||||||
return defered.promise
|
return defered.promise
|
||||||
|
|
||||||
success: (message) ->
|
success: (message) ->
|
||||||
@.el = angular.element(".lightbox-generic-success")
|
el = angular.element(".lightbox-generic-success")
|
||||||
|
|
||||||
# Render content
|
# Render content
|
||||||
@.el.find("h2.title").html(message)
|
el.find("h2.title").html(message)
|
||||||
defered = @q.defer()
|
defered = @q.defer()
|
||||||
|
|
||||||
# Assign event handlers
|
# Assign event handlers
|
||||||
@.el.on "click.confirm-dialog", "a.button-green", (event) =>
|
el.on "click.confirm-dialog", "a.button-green", (event) =>
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
defered.resolve()
|
defered.resolve()
|
||||||
@.hide()
|
@.hide(el)
|
||||||
|
|
||||||
@.el.on "click.confirm-dialog", "a.close", (event) =>
|
el.on "click.confirm-dialog", "a.close", (event) =>
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
defered.resolve()
|
defered.resolve()
|
||||||
@.hide()
|
@.hide(el)
|
||||||
|
|
||||||
@lightboxService.open(@.el)
|
@lightboxService.open(el)
|
||||||
|
|
||||||
return defered.promise
|
return defered.promise
|
||||||
|
|
||||||
|
@ -160,17 +160,17 @@ class ConfirmService extends taiga.Service
|
||||||
# Add default texts to NOTIFICATION_MSG for new notification types
|
# Add default texts to NOTIFICATION_MSG for new notification types
|
||||||
|
|
||||||
selector = ".notification-message-#{type}"
|
selector = ".notification-message-#{type}"
|
||||||
@.el = angular.element(selector)
|
el = angular.element(selector)
|
||||||
|
|
||||||
if title
|
if title
|
||||||
@.el.find("h4").html(title)
|
el.find("h4").html(title)
|
||||||
else
|
else
|
||||||
@.el.find("h4").html(NOTIFICATION_MSG[type].title)
|
el.find("h4").html(NOTIFICATION_MSG[type].title)
|
||||||
|
|
||||||
if message
|
if message
|
||||||
@.el.find("p").html(message)
|
el.find("p").html(message)
|
||||||
else
|
else
|
||||||
@.el.find("p").html(NOTIFICATION_MSG[type].message)
|
el.find("p").html(NOTIFICATION_MSG[type].message)
|
||||||
|
|
||||||
body = angular.element("body")
|
body = angular.element("body")
|
||||||
body.find(".notification-message .notification-light")
|
body.find(".notification-message .notification-light")
|
||||||
|
@ -193,11 +193,11 @@ class ConfirmService extends taiga.Service
|
||||||
|
|
||||||
delete @.tsem
|
delete @.tsem
|
||||||
|
|
||||||
@.el.on "click", ".icon-delete", (event) =>
|
el.on "click", ".icon-delete", (event) =>
|
||||||
body.find(selector)
|
body.find(selector)
|
||||||
.removeClass('active')
|
.removeClass('active')
|
||||||
.addClass('inactive')
|
.addClass('inactive')
|
||||||
|
|
||||||
|
|
||||||
module = angular.module("taigaBase")
|
module = angular.module("taigaCommon")
|
||||||
module.service("$tgConfirm", ConfirmService)
|
module.service("$tgConfirm", ConfirmService)
|
|
@ -135,6 +135,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
finish()
|
finish()
|
||||||
@location.path(@navUrls.resolve("project-issues", {project: @scope.project.slug}))
|
@location.path(@navUrls.resolve("project-issues", {project: @scope.project.slug}))
|
||||||
promise.then null, =>
|
promise.then null, =>
|
||||||
|
finish(false)
|
||||||
@confirm.notify("error")
|
@confirm.notify("error")
|
||||||
|
|
||||||
module.controller("IssueDetailController", IssueDetailController)
|
module.controller("IssueDetailController", IssueDetailController)
|
||||||
|
|
|
@ -626,13 +626,15 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm) ->
|
||||||
$confirm.ask(title, subtitle).then (finish) ->
|
$confirm.ask(title, subtitle).then (finish) ->
|
||||||
promise = $ctrl.deleteMyFilter(customFilterName)
|
promise = $ctrl.deleteMyFilter(customFilterName)
|
||||||
promise.then ->
|
promise.then ->
|
||||||
$ctrl.loadMyFilters().then (filters) ->
|
promise = $ctrl.loadMyFilters()
|
||||||
|
promise.then (filters) ->
|
||||||
finish()
|
finish()
|
||||||
$scope.filters.myFilters = filters
|
$scope.filters.myFilters = filters
|
||||||
renderFilters($scope.filters.myFilters)
|
renderFilters($scope.filters.myFilters)
|
||||||
$ctrl.loadMyFilters().then null, ->
|
promise.then null, ->
|
||||||
finish()
|
finish()
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
|
finish(false)
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,7 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
finish()
|
finish()
|
||||||
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
|
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
|
||||||
promise.then null, =>
|
promise.then null, =>
|
||||||
|
finish(false)
|
||||||
@confirm.notify("error")
|
@confirm.notify("error")
|
||||||
|
|
||||||
module.controller("TaskDetailController", TaskDetailController)
|
module.controller("TaskDetailController", TaskDetailController)
|
||||||
|
|
|
@ -145,6 +145,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
finish()
|
finish()
|
||||||
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
|
@location.path(@navUrls.resolve("project-backlog", {project: @scope.project.slug}))
|
||||||
promise.then null, =>
|
promise.then null, =>
|
||||||
|
finish(false)
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
|
|
||||||
module.controller("UserStoryDetailController", UserStoryDetailController)
|
module.controller("UserStoryDetailController", UserStoryDetailController)
|
||||||
|
|
|
@ -147,6 +147,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
@confirm.notify("success")
|
@confirm.notify("success")
|
||||||
|
|
||||||
onError = =>
|
onError = =>
|
||||||
|
finish(false)
|
||||||
@confirm.notify("error")
|
@confirm.notify("error")
|
||||||
|
|
||||||
@repo.remove(@scope.wiki).then onSuccess, onError
|
@repo.remove(@scope.wiki).then onSuccess, onError
|
||||||
|
|
|
@ -113,12 +113,14 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls) ->
|
||||||
$confirm.ask(title, subtitle).then (finish) =>
|
$confirm.ask(title, subtitle).then (finish) =>
|
||||||
promise = $tgrepo.remove($scope.wikiLinks[linkId])
|
promise = $tgrepo.remove($scope.wikiLinks[linkId])
|
||||||
promise.then ->
|
promise.then ->
|
||||||
$ctrl.loadWikiLinks().then ->
|
promise = $ctrl.loadWikiLinks()
|
||||||
|
promise.then ->
|
||||||
finish()
|
finish()
|
||||||
render($scope.wikiLinks)
|
render($scope.wikiLinks)
|
||||||
$ctrl.loadWikiLinks().then null, ->
|
promise.then null, ->
|
||||||
finish()
|
finish()
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
|
finish(false)
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
|
|
||||||
$el.on "keyup", ".new input", debounce 2000, (event) ->
|
$el.on "keyup", ".new input", debounce 2000, (event) ->
|
||||||
|
|
Loading…
Reference in New Issue