Adding delete confirmation on wiki and wiki links
parent
2f3278652b
commit
0369a35228
|
@ -24,6 +24,7 @@ taiga = @.taiga
|
|||
mixOf = @.taiga.mixOf
|
||||
groupBy = @.taiga.groupBy
|
||||
bindOnce = @.taiga.bindOnce
|
||||
unslugify = @.taiga.unslugify
|
||||
|
||||
module = angular.module("taigaWiki")
|
||||
|
||||
|
@ -99,6 +100,13 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin, taig
|
|||
@location.path("/project/#{@scope.projectSlug}/wiki")
|
||||
onError = =>
|
||||
@confirm.notify("error")
|
||||
|
||||
|
||||
# TODO: i18n
|
||||
title = "Delete Wiki Page"
|
||||
subtitle = unslugify(@scope.wiki.slug)
|
||||
|
||||
@confirm.ask(title, subtitle).then =>
|
||||
@repo.remove(@scope.wiki).then onSuccess, onError
|
||||
|
||||
module.controller("WikiDetailController", WikiDetailController)
|
||||
|
|
|
@ -25,6 +25,7 @@ mixOf = @.taiga.mixOf
|
|||
groupBy = @.taiga.groupBy
|
||||
bindOnce = @.taiga.bindOnce
|
||||
slugify = @.taiga.slugify
|
||||
unslugify = @.taiga.slugify
|
||||
|
||||
module = angular.module("taigaWiki")
|
||||
|
||||
|
@ -86,6 +87,12 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm) ->
|
|||
event.stopPropagation()
|
||||
target = angular.element(event.currentTarget)
|
||||
linkId = target.parents('.wiki-link').data('id')
|
||||
|
||||
# TODO: i18n
|
||||
title = "Delete Wiki Link"
|
||||
subtitle = $scope.wikiLinks[linkId].title
|
||||
|
||||
$confirm.ask(title, subtitle).then =>
|
||||
$tgrepo.remove($scope.wikiLinks[linkId]).then ->
|
||||
$ctrl.loadWikiLinks().then ->
|
||||
render($scope.wikiLinks)
|
||||
|
|
Loading…
Reference in New Issue