Merge pull request #114 from taigaio/bug/1445/confirm.ask_refactor
Fix bug #1445: Refactor: $confirm.ask servicestable
commit
6871dae476
|
@ -432,18 +432,18 @@ MembershipsRowActionsDirective = ($log, $repo, $rs, $confirm) ->
|
|||
event.preventDefault()
|
||||
|
||||
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 = ->
|
||||
finish()
|
||||
$ctrl.loadMembers()
|
||||
$confirm.notify("success", null, "We've deleted #{subtitle}.") # TODO: i18n
|
||||
$confirm.notify("success", null, "We've deleted #{message}.") # TODO: i18n
|
||||
|
||||
onError = ->
|
||||
finish(false)
|
||||
# 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)
|
||||
|
||||
|
|
|
@ -86,9 +86,9 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService, $loading)
|
|||
remove = ->
|
||||
#TODO: i18n
|
||||
title = "Delete sprint"
|
||||
subtitle = $scope.sprint.name
|
||||
message = $scope.sprint.name
|
||||
|
||||
$confirm.ask(title, subtitle).then (finish) =>
|
||||
$confirm.askOnDelete(title, message).then (finish) =>
|
||||
onSuccess = ->
|
||||
finish()
|
||||
$scope.milestonesCounter -= 1
|
||||
|
|
|
@ -469,9 +469,9 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
|
|||
deleteUserStory: (us) ->
|
||||
#TODO: i18n
|
||||
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
|
||||
@scope.userstories = _.without(@scope.userstories, us)
|
||||
@filterVisibleUserstories()
|
||||
|
|
|
@ -127,9 +127,9 @@ class AttachmentsController extends taiga.Controller
|
|||
# Remove one concrete attachment.
|
||||
removeAttachment: (attachment) ->
|
||||
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 = =>
|
||||
finish()
|
||||
index = @.attachments.indexOf(attachment)
|
||||
|
@ -139,7 +139,7 @@ class AttachmentsController extends taiga.Controller
|
|||
|
||||
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 #{message}.")
|
||||
return @q.reject()
|
||||
|
||||
return @repo.remove(attachment).then(onSuccess, onError)
|
||||
|
|
|
@ -165,10 +165,10 @@ WatchersDirective = ($rootscope, $confirm) ->
|
|||
target = angular.element(event.currentTarget)
|
||||
watcherId = target.data("watcher-id")
|
||||
|
||||
title = "Remove watcher"
|
||||
subtitle = $scope.usersById[watcherId].full_name_display
|
||||
title = "Delete watcher"
|
||||
message = $scope.usersById[watcherId].full_name_display
|
||||
|
||||
$confirm.ask(title, subtitle).then (finish) =>
|
||||
$confirm.askOnDelete(title, message).then (finish) =>
|
||||
finish()
|
||||
watcherIds = _.clone($model.$modelValue.watchers, false)
|
||||
watcherIds = _.pull(watcherIds, watcherId)
|
||||
|
@ -250,10 +250,10 @@ AssignedToDirective = ($rootscope, $confirm) ->
|
|||
|
||||
$el.on "click", ".icon-delete", (event) ->
|
||||
event.preventDefault()
|
||||
title = "Remove assigned to"
|
||||
subtitle = ""
|
||||
title = "Delete assignetion"
|
||||
message = ""
|
||||
|
||||
$confirm.ask(title, subtitle).then (finish) =>
|
||||
$confirm.askOnDelete(title, message).then (finish) =>
|
||||
finish()
|
||||
$model.$modelValue.assigned_to = null
|
||||
renderAssignedTo($model.$modelValue)
|
||||
|
|
|
@ -50,14 +50,13 @@ class ConfirmService extends taiga.Service
|
|||
|
||||
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)
|
||||
|
||||
# Render content
|
||||
el.find("h2.title").html(title)
|
||||
el.find("span.subtitle").html(subtitle)
|
||||
if message
|
||||
el.find("span.delete-question").html(message)
|
||||
el.find("span.message").html(message)
|
||||
|
||||
defered = @q.defer()
|
||||
|
||||
|
@ -80,6 +79,9 @@ class ConfirmService extends taiga.Service
|
|||
|
||||
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") ->
|
||||
el = angular.element(lightboxSelector)
|
||||
|
||||
|
|
|
@ -143,9 +143,9 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
delete: ->
|
||||
# TODO: i18n
|
||||
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.then =>
|
||||
finish()
|
||||
|
|
|
@ -642,9 +642,9 @@ IssuesFiltersDirective = ($log, $location, $rs, $confirm, $loading) ->
|
|||
target = angular.element(event.currentTarget)
|
||||
customFilterName = target.parent().data('id')
|
||||
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.then ->
|
||||
promise = $ctrl.loadMyFilters()
|
||||
|
|
|
@ -139,9 +139,9 @@ RelatedTaskRowDirective = ($repo, $compile, $confirm, $rootscope, $loading) ->
|
|||
#TODO: i18n
|
||||
task = $model.$modelValue
|
||||
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.then ->
|
||||
finish()
|
||||
|
|
|
@ -134,9 +134,9 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
delete: ->
|
||||
#TODO: i18n
|
||||
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.then =>
|
||||
finish()
|
||||
|
|
|
@ -146,9 +146,9 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
delete: ->
|
||||
#TODO: i18n
|
||||
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.then =>
|
||||
finish()
|
||||
|
|
|
@ -138,9 +138,9 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
delete: ->
|
||||
# TODO: i18n
|
||||
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 = =>
|
||||
finish()
|
||||
ctx = {project: @scope.projectSlug}
|
||||
|
|
|
@ -107,9 +107,9 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $l
|
|||
|
||||
# TODO: i18n
|
||||
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.then ->
|
||||
promise = $ctrl.loadWikiLinks()
|
||||
|
|
|
@ -21,8 +21,8 @@ html(lang="en", ng-app="taiga")
|
|||
|
||||
div.master(ng-view)
|
||||
|
||||
div.hidden.lightbox.lightbox-confirm-delete
|
||||
include partials/views/modules/lightbox-confirm-delete
|
||||
div.hidden.lightbox.lightbox-generic-ask
|
||||
include partials/views/modules/lightbox-generic-ask
|
||||
div.hidden.lightbox.lightbox-ask-choice
|
||||
include partials/views/modules/lightbox-ask-choice
|
||||
div.hidden.lightbox.lightbox-generic-success
|
||||
|
|
|
@ -7,6 +7,6 @@ section
|
|||
|
||||
block content
|
||||
|
||||
div.delete-options
|
||||
div.options
|
||||
a.button.button-green(href="", title="Accept")
|
||||
span Accept
|
||||
|
|
|
@ -3,11 +3,11 @@ a.close(href="", title="close")
|
|||
form
|
||||
h2.title Delete User Story
|
||||
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.replacement What value do you want to use as replacement?
|
||||
select.choices
|
||||
div.delete-options
|
||||
div.options
|
||||
a.button.button-green(href="", title="Accept")
|
||||
span Accept
|
||||
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
|
||||
h2.title Delete Taiga Account
|
||||
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! :-(
|
||||
div.delete-options
|
||||
div.options
|
||||
a.button.button-green(href="", title="Accept")
|
||||
span Accept
|
||||
a.button.button-red(href="", title="Cancel")
|
||||
|
|
|
@ -3,9 +3,9 @@ a.close(href="", title="close")
|
|||
form
|
||||
h2.title Delete project
|
||||
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! :-(
|
||||
div.delete-options
|
||||
div.options
|
||||
a.button.button-green(href="", title="Yes, I'm really sure")
|
||||
span Yes, I'm really sure
|
||||
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
|
||||
section
|
||||
h2.title
|
||||
div.delete-options
|
||||
div.options
|
||||
a.button.button-green(href="", title="Accept")
|
||||
span Accept
|
||||
|
|
|
@ -2,6 +2,6 @@ a.close(href="", title="close")
|
|||
span.icon.icon-delete
|
||||
section
|
||||
h2.title
|
||||
div.delete-options
|
||||
div.options
|
||||
a.button.button-green(href="", title="Accept")
|
||||
span Accept
|
||||
|
|
|
@ -283,12 +283,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
.lightbox-confirm-delete {
|
||||
.lightbox-generic-ask {
|
||||
form {
|
||||
@include table-flex-child(0, 420px, 0, 420px);
|
||||
}
|
||||
.delete-question,
|
||||
.subtitle {
|
||||
.subtitle,
|
||||
.message {
|
||||
display: block;
|
||||
line-height: 2rem;
|
||||
text-align: center;
|
||||
|
@ -297,7 +297,7 @@
|
|||
@extend %large;
|
||||
@extend %title;
|
||||
}
|
||||
.delete-options {
|
||||
.options {
|
||||
@include table-flex();
|
||||
a {
|
||||
@include table-flex-child(1, 0, 0);
|
||||
|
@ -314,7 +314,7 @@
|
|||
form {
|
||||
@include table-flex-child(0, 420px, 0, 420px);
|
||||
}
|
||||
.delete-question,
|
||||
.question,
|
||||
.subtitle {
|
||||
display: block;
|
||||
line-height: 2rem;
|
||||
|
@ -328,7 +328,7 @@
|
|||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
.delete-options {
|
||||
.options {
|
||||
@include table-flex();
|
||||
a {
|
||||
@include table-flex-child(1, 0, 0);
|
||||
|
@ -345,7 +345,7 @@
|
|||
form {
|
||||
@include table-flex-child(0, 420px, 0, 420px);
|
||||
}
|
||||
.delete-question,
|
||||
.question,
|
||||
.subtitle {
|
||||
display: block;
|
||||
line-height: 2rem;
|
||||
|
@ -372,7 +372,7 @@
|
|||
form {
|
||||
@include table-flex-child(0, 420px, 0, 420px);
|
||||
}
|
||||
.delete-question,
|
||||
.question,
|
||||
.subtitle {
|
||||
display: block;
|
||||
line-height: 2rem;
|
||||
|
@ -382,7 +382,7 @@
|
|||
@extend %large;
|
||||
@extend %title;
|
||||
}
|
||||
.newsletter-delete {
|
||||
.newsletter {
|
||||
margin-top: 1rem;
|
||||
text-align: center;
|
||||
input {
|
||||
|
@ -393,7 +393,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.delete-options {
|
||||
.options {
|
||||
@include table-flex();
|
||||
a {
|
||||
@include table-flex-child(1, 0, 0);
|
||||
|
@ -410,7 +410,7 @@
|
|||
form {
|
||||
@include table-flex-child(0, 420px, 0, 420px);
|
||||
}
|
||||
.delete-question,
|
||||
.question,
|
||||
.subtitle {
|
||||
display: block;
|
||||
line-height: 2rem;
|
||||
|
@ -420,7 +420,7 @@
|
|||
@extend %large;
|
||||
@extend %title;
|
||||
}
|
||||
.delete-options {
|
||||
.options {
|
||||
@include table-flex();
|
||||
a {
|
||||
@include table-flex-child(1, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue