Custom delete in due dates admin

stable
Álex Hermida 2018-08-09 11:46:38 +02:00 committed by Alex Hermida
parent 8011f49f49
commit 07a38b8d63
3 changed files with 25 additions and 2 deletions

View File

@ -443,6 +443,25 @@ ProjectDueDatesValues = ($log, $repo, $confirm, $location, animationFrame, $tran
target = $el.find(".new-value") target = $el.find(".new-value")
saveNewValue(target) saveNewValue(target)
$el.on "click", ".delete-due-date", (event) ->
event.preventDefault()
target = angular.element(event.currentTarget)
formEl = target.parents("form")
value = formEl.scope().value
title = $translate.instant("LIGHTBOX.ADMIN_DUE_DATES.TITLE_ACTION_DELETE_DUE_DATE")
subtitle = $translate.instant("LIGHTBOX.ADMIN_DUE_DATES.SUBTITLE_ACTION_DELETE_DUE_DATE",
{due_date_status_name: value.name})
$confirm.ask(title, subtitle).then (response) ->
onSucces = ->
$ctrl.loadValues().finally ->
response.finish()
onError = ->
$confirm.notify("error")
$repo.remove(value).then(onSucces, onError)
return { return {
link: ($scope, $el, $attrs) -> link: ($scope, $el, $attrs) ->
parentDirective.link($scope, $el, $attrs) parentDirective.link($scope, $el, $attrs)

View File

@ -629,7 +629,7 @@
"DAYS_TO_DUE_DATE": "Days to due date", "DAYS_TO_DUE_DATE": "Days to due date",
"BEFORE_AFTER": "Before/after", "BEFORE_AFTER": "Before/after",
"BEFORE": "Before", "BEFORE": "Before",
"AFTER": "After" "AFTER": "Past"
}, },
"ROLES": { "ROLES": {
"PAGE_TITLE": "Roles - {{projectName}}", "PAGE_TITLE": "Roles - {{projectName}}",
@ -1172,6 +1172,10 @@
}, },
"TITLE_ACTION_DELETE_DUE_DATE": "Delete due date" "TITLE_ACTION_DELETE_DUE_DATE": "Delete due date"
}, },
"ADMIN_DUE_DATES": {
"TITLE_ACTION_DELETE_DUE_DATE": "Delete due date",
"SUBTITLE_ACTION_DELETE_DUE_DATE": "Are you sure you want to delete the due date status {{due_date_status_name}}?"
},
"RELATE_TO_EPIC": { "RELATE_TO_EPIC": {
"TITLE": "Link to Epic", "TITLE": "Link to Epic",
"EXISTING_EPIC": "Existing epic", "EXISTING_EPIC": "Existing epic",

View File

@ -38,7 +38,7 @@ section.colors-table.admin-status-table
title="{{'ADMIN.COMMON.TITLE_ACTION_EDIT_VALUE' | translate}}", title="{{'ADMIN.COMMON.TITLE_ACTION_EDIT_VALUE' | translate}}",
svg-icon="icon-edit" svg-icon="icon-edit"
) )
a.delete-value(href="", ng-if="!value.by_default") a.delete-due-date(href="", ng-if="!value.by_default")
tg-svg( tg-svg(
title="{{'ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE' | translate}}" title="{{'ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE' | translate}}"
svg-icon="icon-trash" svg-icon="icon-trash"