From 07a38b8d638f4053b36bc5f6e40b637bc6f1e513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Hermida?= Date: Thu, 9 Aug 2018 11:46:38 +0200 Subject: [PATCH] Custom delete in due dates admin --- .../modules/admin/project-values.coffee | 19 +++++++++++++++++++ app/locales/taiga/locale-en.json | 6 +++++- .../admin/project-due-date-status.jade | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/coffee/modules/admin/project-values.coffee b/app/coffee/modules/admin/project-values.coffee index 90027ef4..4b440745 100644 --- a/app/coffee/modules/admin/project-values.coffee +++ b/app/coffee/modules/admin/project-values.coffee @@ -443,6 +443,25 @@ ProjectDueDatesValues = ($log, $repo, $confirm, $location, animationFrame, $tran target = $el.find(".new-value") 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 { link: ($scope, $el, $attrs) -> parentDirective.link($scope, $el, $attrs) diff --git a/app/locales/taiga/locale-en.json b/app/locales/taiga/locale-en.json index d82f6d19..6a6863f3 100644 --- a/app/locales/taiga/locale-en.json +++ b/app/locales/taiga/locale-en.json @@ -629,7 +629,7 @@ "DAYS_TO_DUE_DATE": "Days to due date", "BEFORE_AFTER": "Before/after", "BEFORE": "Before", - "AFTER": "After" + "AFTER": "Past" }, "ROLES": { "PAGE_TITLE": "Roles - {{projectName}}", @@ -1172,6 +1172,10 @@ }, "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": { "TITLE": "Link to Epic", "EXISTING_EPIC": "Existing epic", diff --git a/app/partials/includes/modules/admin/project-due-date-status.jade b/app/partials/includes/modules/admin/project-due-date-status.jade index a72695cd..bd4448c4 100644 --- a/app/partials/includes/modules/admin/project-due-date-status.jade +++ b/app/partials/includes/modules/admin/project-due-date-status.jade @@ -38,7 +38,7 @@ section.colors-table.admin-status-table title="{{'ADMIN.COMMON.TITLE_ACTION_EDIT_VALUE' | translate}}", 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( title="{{'ADMIN.COMMON.TITLE_ACTION_DELETE_VALUE' | translate}}" svg-icon="icon-trash"