Fix bug #1445: Refactor: $confirm.ask service
parent
ead27ba7b4
commit
fb8756e30b
|
@ -432,18 +432,18 @@ MembershipsRowActionsDirective = ($log, $repo, $rs, $confirm) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
title = "Delete member" # TODO: i18n
|
title = "Delete member" # TODO: i18n
|
||||||
subtitle = if member.user then member.full_name else "the invitation to #{member.email}" # TODO: i18n
|
message = if member.user then member.full_name else "the invitation to #{member.email}" # TODO: i18n
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then (finish) ->
|
$confirm.askOnDelete(title, message).then (finish) ->
|
||||||
onSuccess = ->
|
onSuccess = ->
|
||||||
finish()
|
finish()
|
||||||
$ctrl.loadMembers()
|
$ctrl.loadMembers()
|
||||||
$confirm.notify("success", null, "We've deleted #{subtitle}.") # TODO: i18n
|
$confirm.notify("success", null, "We've deleted #{message}.") # TODO: i18n
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
finish(false)
|
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 #{message}.")
|
||||||
|
|
||||||
$repo.remove(member).then(onSuccess, onError)
|
$repo.remove(member).then(onSuccess, onError)
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,9 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading)
|
||||||
remove = ->
|
remove = ->
|
||||||
#TODO: i18n
|
#TODO: i18n
|
||||||
title = "Delete sprint"
|
title = "Delete sprint"
|
||||||
subtitle = $scope.sprint.name
|
message = $scope.sprint.name
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then (finish) =>
|
$confirm.askOnDelete(title, message).then (finish) =>
|
||||||
onSuccess = ->
|
onSuccess = ->
|
||||||
finish()
|
finish()
|
||||||
$scope.milestonesCounter -= 1
|
$scope.milestonesCounter -= 1
|
||||||
|
|
|
@ -469,9 +469,9 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
||||||
deleteUserStory: (us) ->
|
deleteUserStory: (us) ->
|
||||||
#TODO: i18n
|
#TODO: i18n
|
||||||
title = "Delete User Story"
|
title = "Delete User Story"
|
||||||
subtitle = us.subject
|
message = us.subject
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then (finish) =>
|
@confirm.askOnDelete(title, message).then (finish) =>
|
||||||
# We modify the userstories in scope so the user doesn't see the removed US for a while
|
# We modify the userstories in scope so the user doesn't see the removed US for a while
|
||||||
@scope.userstories = _.without(@scope.userstories, us)
|
@scope.userstories = _.without(@scope.userstories, us)
|
||||||
@filterVisibleUserstories()
|
@filterVisibleUserstories()
|
||||||
|
|
|
@ -127,9 +127,9 @@ class AttachmentsController extends taiga.Controller
|
||||||
# Remove one concrete attachment.
|
# Remove one concrete attachment.
|
||||||
removeAttachment: (attachment) ->
|
removeAttachment: (attachment) ->
|
||||||
title = "Delete attachment" #TODO: i18in
|
title = "Delete attachment" #TODO: i18in
|
||||||
subtitle = "the attachment '#{attachment.name}'" #TODO: i18in
|
message = "the attachment '#{attachment.name}'" #TODO: i18in
|
||||||
|
|
||||||
return @confirm.ask(title, subtitle).then (finish) =>
|
return @confirm.askOnDelete(title, message).then (finish) =>
|
||||||
onSuccess = =>
|
onSuccess = =>
|
||||||
finish()
|
finish()
|
||||||
index = @.attachments.indexOf(attachment)
|
index = @.attachments.indexOf(attachment)
|
||||||
|
@ -139,7 +139,7 @@ class AttachmentsController extends taiga.Controller
|
||||||
|
|
||||||
onError = =>
|
onError = =>
|
||||||
finish(false)
|
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 #{message}.")
|
||||||
return @q.reject()
|
return @q.reject()
|
||||||
|
|
||||||
return @repo.remove(attachment).then(onSuccess, onError)
|
return @repo.remove(attachment).then(onSuccess, onError)
|
||||||
|
|
|
@ -165,10 +165,10 @@ WatchersDirective = ($rootscope, $confirm) ->
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
watcherId = target.data("watcher-id")
|
watcherId = target.data("watcher-id")
|
||||||
|
|
||||||
title = "Remove watcher"
|
title = "Delete watcher"
|
||||||
subtitle = $scope.usersById[watcherId].full_name_display
|
message = $scope.usersById[watcherId].full_name_display
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then (finish) =>
|
$confirm.askOnDelete(title, message).then (finish) =>
|
||||||
finish()
|
finish()
|
||||||
watcherIds = _.clone($model.$modelValue.watchers, false)
|
watcherIds = _.clone($model.$modelValue.watchers, false)
|
||||||
watcherIds = _.pull(watcherIds, watcherId)
|
watcherIds = _.pull(watcherIds, watcherId)
|
||||||
|
@ -250,10 +250,10 @@ AssignedToDirective = ($rootscope, $confirm) ->
|
||||||
|
|
||||||
$el.on "click", ".icon-delete", (event) ->
|
$el.on "click", ".icon-delete", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
title = "Remove assigned to"
|
title = "Delete assignetion"
|
||||||
subtitle = ""
|
message = ""
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then (finish) =>
|
$confirm.askOnDelete(title, message).then (finish) =>
|
||||||
finish()
|
finish()
|
||||||
$model.$modelValue.assigned_to = null
|
$model.$modelValue.assigned_to = null
|
||||||
renderAssignedTo($model.$modelValue)
|
renderAssignedTo($model.$modelValue)
|
||||||
|
|
|
@ -50,14 +50,13 @@ class ConfirmService extends taiga.Service
|
||||||
|
|
||||||
el.off(".confirm-dialog")
|
el.off(".confirm-dialog")
|
||||||
|
|
||||||
ask: (title, subtitle, message=null, lightboxSelector=".lightbox-confirm-delete") ->
|
ask: (title, subtitle, message, lightboxSelector=".lightbox-generic-ask") ->
|
||||||
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)
|
||||||
if message
|
el.find("span.message").html(message)
|
||||||
el.find("span.delete-question").html(message)
|
|
||||||
|
|
||||||
defered = @q.defer()
|
defered = @q.defer()
|
||||||
|
|
||||||
|
@ -80,6 +79,9 @@ class ConfirmService extends taiga.Service
|
||||||
|
|
||||||
return defered.promise
|
return defered.promise
|
||||||
|
|
||||||
|
askOnDelete: (title, message) ->
|
||||||
|
return @.ask(title, "Are you sure you want to delete?", message) #TODO: i18n
|
||||||
|
|
||||||
askChoice: (title, subtitle, choices, lightboxSelector=".lightbox-ask-choice") ->
|
askChoice: (title, subtitle, choices, lightboxSelector=".lightbox-ask-choice") ->
|
||||||
el = angular.element(lightboxSelector)
|
el = angular.element(lightboxSelector)
|
||||||
|
|
||||||
|
|
|
@ -143,9 +143,9 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
delete: ->
|
delete: ->
|
||||||
# TODO: i18n
|
# TODO: i18n
|
||||||
title = "Delete Issue"
|
title = "Delete Issue"
|
||||||
subtitle = @scope.issue.subject
|
message = @scope.issue.subject
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then (finish) =>
|
@confirm.askOnDelete(title, message).then (finish) =>
|
||||||
promise = @.repo.remove(@scope.issue)
|
promise = @.repo.remove(@scope.issue)
|
||||||
promise.then =>
|
promise.then =>
|
||||||
finish()
|
finish()
|
||||||
|
|
|
@ -642,9 +642,9 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm, $loading) ->
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
customFilterName = target.parent().data('id')
|
customFilterName = target.parent().data('id')
|
||||||
title = "Delete custom filter" # TODO: i18n
|
title = "Delete custom filter" # TODO: i18n
|
||||||
subtitle = "the custom filter '#{customFilterName}'" # TODO: i18n
|
message = "the custom filter '#{customFilterName}'" # TODO: i18n
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then (finish) ->
|
$confirm.askOnDelete(title, message).then (finish) ->
|
||||||
promise = $ctrl.deleteMyFilter(customFilterName)
|
promise = $ctrl.deleteMyFilter(customFilterName)
|
||||||
promise.then ->
|
promise.then ->
|
||||||
promise = $ctrl.loadMyFilters()
|
promise = $ctrl.loadMyFilters()
|
||||||
|
|
|
@ -139,9 +139,9 @@ RelatedTaskRowDirective = ($repo, $compile, $confirm, $rootscope, $loading) ->
|
||||||
#TODO: i18n
|
#TODO: i18n
|
||||||
task = $model.$modelValue
|
task = $model.$modelValue
|
||||||
title = "Delete Task"
|
title = "Delete Task"
|
||||||
subtitle = task.subject
|
message = task.subject
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then (finish) ->
|
$confirm.askOnDelete(title, message).then (finish) ->
|
||||||
promise = $repo.remove(task)
|
promise = $repo.remove(task)
|
||||||
promise.then ->
|
promise.then ->
|
||||||
finish()
|
finish()
|
||||||
|
|
|
@ -134,9 +134,9 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
delete: ->
|
delete: ->
|
||||||
#TODO: i18n
|
#TODO: i18n
|
||||||
title = "Delete Task"
|
title = "Delete Task"
|
||||||
subtitle = @scope.task.subject
|
message = @scope.task.subject
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then (finish) =>
|
@confirm.askOnDelete(title, message).then (finish) =>
|
||||||
promise = @.repo.remove(@scope.task)
|
promise = @.repo.remove(@scope.task)
|
||||||
promise.then =>
|
promise.then =>
|
||||||
finish()
|
finish()
|
||||||
|
|
|
@ -146,9 +146,9 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
delete: ->
|
delete: ->
|
||||||
#TODO: i18n
|
#TODO: i18n
|
||||||
title = "Delete User Story"
|
title = "Delete User Story"
|
||||||
subtitle = @scope.us.subject
|
message = @scope.us.subject
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then (finish) =>
|
@confirm.askOnDelete(title, message).then (finish) =>
|
||||||
promise = @.repo.remove(@scope.us)
|
promise = @.repo.remove(@scope.us)
|
||||||
promise.then =>
|
promise.then =>
|
||||||
finish()
|
finish()
|
||||||
|
|
|
@ -138,9 +138,9 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
delete: ->
|
delete: ->
|
||||||
# TODO: i18n
|
# TODO: i18n
|
||||||
title = "Delete Wiki Page"
|
title = "Delete Wiki Page"
|
||||||
subtitle = unslugify(@scope.wiki.slug)
|
message = unslugify(@scope.wiki.slug)
|
||||||
|
|
||||||
@confirm.ask(title, subtitle).then (finish) =>
|
@confirm.askOnDelete(title, message).then (finish) =>
|
||||||
onSuccess = =>
|
onSuccess = =>
|
||||||
finish()
|
finish()
|
||||||
ctx = {project: @scope.projectSlug}
|
ctx = {project: @scope.projectSlug}
|
||||||
|
|
|
@ -107,9 +107,9 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $l
|
||||||
|
|
||||||
# TODO: i18n
|
# TODO: i18n
|
||||||
title = "Delete Wiki Link"
|
title = "Delete Wiki Link"
|
||||||
subtitle = $scope.wikiLinks[linkId].title
|
message = $scope.wikiLinks[linkId].title
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then (finish) =>
|
$confirm.askOnDelete(title, message).then (finish) =>
|
||||||
promise = $tgrepo.remove($scope.wikiLinks[linkId])
|
promise = $tgrepo.remove($scope.wikiLinks[linkId])
|
||||||
promise.then ->
|
promise.then ->
|
||||||
promise = $ctrl.loadWikiLinks()
|
promise = $ctrl.loadWikiLinks()
|
||||||
|
|
|
@ -21,8 +21,8 @@ html(lang="en", ng-app="taiga")
|
||||||
|
|
||||||
div.master(ng-view)
|
div.master(ng-view)
|
||||||
|
|
||||||
div.hidden.lightbox.lightbox-confirm-delete
|
div.hidden.lightbox.lightbox-generic-ask
|
||||||
include partials/views/modules/lightbox-confirm-delete
|
include partials/views/modules/lightbox-generic-ask
|
||||||
div.hidden.lightbox.lightbox-ask-choice
|
div.hidden.lightbox.lightbox-ask-choice
|
||||||
include partials/views/modules/lightbox-ask-choice
|
include partials/views/modules/lightbox-ask-choice
|
||||||
div.hidden.lightbox.lightbox-generic-success
|
div.hidden.lightbox.lightbox-generic-success
|
||||||
|
|
|
@ -7,6 +7,6 @@ section
|
||||||
|
|
||||||
block content
|
block content
|
||||||
|
|
||||||
div.delete-options
|
div.options
|
||||||
a.button.button-green(href="", title="Accept")
|
a.button.button-green(href="", title="Accept")
|
||||||
span Accept
|
span Accept
|
||||||
|
|
|
@ -3,11 +3,11 @@ a.close(href="", title="close")
|
||||||
form
|
form
|
||||||
h2.title Delete User Story
|
h2.title Delete User Story
|
||||||
p
|
p
|
||||||
span.delete-question Are you sure you want to delete?
|
span.question Are you sure you want to delete?
|
||||||
span.subtitle #125 Crear el perfil de usuario senior en el admin
|
span.subtitle #125 Crear el perfil de usuario senior en el admin
|
||||||
span.replacement What value do you want to use as replacement?
|
span.replacement What value do you want to use as replacement?
|
||||||
select.choices
|
select.choices
|
||||||
div.delete-options
|
div.options
|
||||||
a.button.button-green(href="", title="Accept")
|
a.button.button-green(href="", title="Accept")
|
||||||
span Accept
|
span Accept
|
||||||
a.button.button-red(href="", title="Delete")
|
a.button.button-red(href="", title="Delete")
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
a.close(href="", title="close")
|
|
||||||
span.icon.icon-delete
|
|
||||||
form
|
|
||||||
h2.title Delete User Story
|
|
||||||
p
|
|
||||||
span.delete-question Are you sure you want to delete?
|
|
||||||
span.subtitle #125 Crear el perfil de usuario senior en el admin
|
|
||||||
div.delete-options
|
|
||||||
a.button.button-green(href="", title="Accept")
|
|
||||||
span Accept
|
|
||||||
a.button.button-red(href="", title="Delete")
|
|
||||||
span Cancel
|
|
|
@ -3,9 +3,9 @@ a.close(href="", title="close")
|
||||||
form
|
form
|
||||||
h2.title Delete Taiga Account
|
h2.title Delete Taiga Account
|
||||||
p
|
p
|
||||||
span.delete-question Are you sure you want to delete your Taiga account?
|
span.question Are you sure you want to delete your Taiga account?
|
||||||
span.subtitle We're going to miss you! :-(
|
span.subtitle We're going to miss you! :-(
|
||||||
div.delete-options
|
div.options
|
||||||
a.button.button-green(href="", title="Accept")
|
a.button.button-green(href="", title="Accept")
|
||||||
span Accept
|
span Accept
|
||||||
a.button.button-red(href="", title="Cancel")
|
a.button.button-red(href="", title="Cancel")
|
||||||
|
|
|
@ -3,9 +3,9 @@ a.close(href="", title="close")
|
||||||
form
|
form
|
||||||
h2.title Delete project
|
h2.title Delete project
|
||||||
p
|
p
|
||||||
span.delete-question Are you sure you want to delete this project?
|
span.question Are you sure you want to delete this project?
|
||||||
span.subtitle All project data US/Tasks/Issues/Sprints/WikiPages will be lost! :-(
|
span.subtitle All project data US/Tasks/Issues/Sprints/WikiPages will be lost! :-(
|
||||||
div.delete-options
|
div.options
|
||||||
a.button.button-green(href="", title="Yes, I'm really sure")
|
a.button.button-green(href="", title="Yes, I'm really sure")
|
||||||
span Yes, I'm really sure
|
span Yes, I'm really sure
|
||||||
a.button.button-red(href="", title="Cancel")
|
a.button.button-red(href="", title="Cancel")
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
a.close(href="", title="close")
|
||||||
|
span.icon.icon-delete
|
||||||
|
form
|
||||||
|
h2.title
|
||||||
|
p
|
||||||
|
span.subtitle
|
||||||
|
span.message
|
||||||
|
div.options
|
||||||
|
a.button.button-green(href="", title="Accept")
|
||||||
|
span Accept
|
||||||
|
a.button.button-red(href="", title="Delete")
|
||||||
|
span Cancel
|
|
@ -2,6 +2,6 @@ a.close(href="", title="close")
|
||||||
span.icon.icon-delete
|
span.icon.icon-delete
|
||||||
section
|
section
|
||||||
h2.title
|
h2.title
|
||||||
div.delete-options
|
div.options
|
||||||
a.button.button-green(href="", title="Accept")
|
a.button.button-green(href="", title="Accept")
|
||||||
span Accept
|
span Accept
|
||||||
|
|
|
@ -2,6 +2,6 @@ a.close(href="", title="close")
|
||||||
span.icon.icon-delete
|
span.icon.icon-delete
|
||||||
section
|
section
|
||||||
h2.title
|
h2.title
|
||||||
div.delete-options
|
div.options
|
||||||
a.button.button-green(href="", title="Accept")
|
a.button.button-green(href="", title="Accept")
|
||||||
span Accept
|
span Accept
|
||||||
|
|
|
@ -283,12 +283,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lightbox-confirm-delete {
|
.lightbox-generic-ask {
|
||||||
form {
|
form {
|
||||||
@include table-flex-child(0, 420px, 0, 420px);
|
@include table-flex-child(0, 420px, 0, 420px);
|
||||||
}
|
}
|
||||||
.delete-question,
|
.subtitle,
|
||||||
.subtitle {
|
.message {
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -297,7 +297,7 @@
|
||||||
@extend %large;
|
@extend %large;
|
||||||
@extend %title;
|
@extend %title;
|
||||||
}
|
}
|
||||||
.delete-options {
|
.options {
|
||||||
@include table-flex();
|
@include table-flex();
|
||||||
a {
|
a {
|
||||||
@include table-flex-child(1, 0, 0);
|
@include table-flex-child(1, 0, 0);
|
||||||
|
@ -314,7 +314,7 @@
|
||||||
form {
|
form {
|
||||||
@include table-flex-child(0, 420px, 0, 420px);
|
@include table-flex-child(0, 420px, 0, 420px);
|
||||||
}
|
}
|
||||||
.delete-question,
|
.question,
|
||||||
.subtitle {
|
.subtitle {
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
|
@ -328,7 +328,7 @@
|
||||||
display: block;
|
display: block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.delete-options {
|
.options {
|
||||||
@include table-flex();
|
@include table-flex();
|
||||||
a {
|
a {
|
||||||
@include table-flex-child(1, 0, 0);
|
@include table-flex-child(1, 0, 0);
|
||||||
|
@ -345,7 +345,7 @@
|
||||||
form {
|
form {
|
||||||
@include table-flex-child(0, 420px, 0, 420px);
|
@include table-flex-child(0, 420px, 0, 420px);
|
||||||
}
|
}
|
||||||
.delete-question,
|
.question,
|
||||||
.subtitle {
|
.subtitle {
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
|
@ -372,7 +372,7 @@
|
||||||
form {
|
form {
|
||||||
@include table-flex-child(0, 420px, 0, 420px);
|
@include table-flex-child(0, 420px, 0, 420px);
|
||||||
}
|
}
|
||||||
.delete-question,
|
.question,
|
||||||
.subtitle {
|
.subtitle {
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
|
@ -382,7 +382,7 @@
|
||||||
@extend %large;
|
@extend %large;
|
||||||
@extend %title;
|
@extend %title;
|
||||||
}
|
}
|
||||||
.newsletter-delete {
|
.newsletter {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
input {
|
input {
|
||||||
|
@ -393,7 +393,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.delete-options {
|
.options {
|
||||||
@include table-flex();
|
@include table-flex();
|
||||||
a {
|
a {
|
||||||
@include table-flex-child(1, 0, 0);
|
@include table-flex-child(1, 0, 0);
|
||||||
|
@ -410,7 +410,7 @@
|
||||||
form {
|
form {
|
||||||
@include table-flex-child(0, 420px, 0, 420px);
|
@include table-flex-child(0, 420px, 0, 420px);
|
||||||
}
|
}
|
||||||
.delete-question,
|
.question,
|
||||||
.subtitle {
|
.subtitle {
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
|
@ -420,7 +420,7 @@
|
||||||
@extend %large;
|
@extend %large;
|
||||||
@extend %title;
|
@extend %title;
|
||||||
}
|
}
|
||||||
.delete-options {
|
.options {
|
||||||
@include table-flex();
|
@include table-flex();
|
||||||
a {
|
a {
|
||||||
@include table-flex-child(1, 0, 0);
|
@include table-flex-child(1, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue