From a11221834a68d132d8f5b5b4b040a053960cea5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 27 Aug 2014 16:36:10 +0200 Subject: [PATCH] Show confirmation lightbox before remove a custom filter --- app/coffee/modules/issues/list.coffee | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/coffee/modules/issues/list.coffee b/app/coffee/modules/issues/list.coffee index ed1bb4a1..4661494f 100644 --- a/app/coffee/modules/issues/list.coffee +++ b/app/coffee/modules/issues/list.coffee @@ -451,11 +451,14 @@ IssuesDirective = ($log, $location) -> return {link:link} +module.directive("tgIssues", ["$log", "$tgLocation", IssuesDirective]) + + ############################################################################# ## Issues Filters Directive ############################################################################# -IssuesFiltersDirective = ($log, $location, $rs) -> +IssuesFiltersDirective = ($log, $location, $rs, $confirm) -> template = _.template(""" <% _.each(filters, function(f) { %> <% if (!f.selected) { %> @@ -623,11 +626,17 @@ IssuesFiltersDirective = ($log, $location, $rs) -> $el.on "click", ".filter-list .single-filter .icon-delete", (event) -> event.preventDefault() event.stopPropagation() + target = angular.element(event.currentTarget) - $ctrl.deleteMyFilter(target.parent().data('id')).then -> - $ctrl.loadMyFilters().then (filters) -> - $scope.filters.myFilters = filters - renderFilters($scope.filters.myFilters) + customFilterName = target.parent().data('id') + title = "Delete custom filter" # TODO: i18n + subtitle = "the custom filter '#{customFilterName}'" # TODO: i18n + + $confirm.ask(title, subtitle).then -> + $ctrl.deleteMyFilter(customFilterName).then -> + $ctrl.loadMyFilters().then (filters) -> + $scope.filters.myFilters = filters + renderFilters($scope.filters.myFilters) $el.on "click", ".save-filters", (event) -> event.preventDefault() @@ -659,8 +668,8 @@ IssuesFiltersDirective = ($log, $location, $rs) -> return {link:link} -module.directive("tgIssuesFilters", ["$log", "$tgLocation", "$tgResources", IssuesFiltersDirective]) -module.directive("tgIssues", ["$log", "$tgLocation", IssuesDirective]) +module.directive("tgIssuesFilters", ["$log", "$tgLocation", "$tgResources", "$tgConfirm", + IssuesFiltersDirective]) ############################################################################# @@ -735,10 +744,6 @@ IssueStatusInlineEditionDirective = ($repo, popoverService) -> module.directive("tgIssueStatusInlineEdition", ["$tgRepo", IssueStatusInlineEditionDirective]) - - - - ############################################################################# ## Issue assigned to Directive #############################################################################