From ea53e08a21c8267f3644ce25d5939204be23f707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 3 Sep 2014 17:53:39 +0200 Subject: [PATCH] Show a confirm message when a project notification is changed --- app/coffee/modules/user-settings/notifications.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/coffee/modules/user-settings/notifications.coffee b/app/coffee/modules/user-settings/notifications.coffee index 52c5e5fe..db470d1c 100644 --- a/app/coffee/modules/user-settings/notifications.coffee +++ b/app/coffee/modules/user-settings/notifications.coffee @@ -143,11 +143,15 @@ UserNotificationsListDirective = ($repo, $confirm) -> prev_level = policy.notify_level policy.notify_level = parseInt(target.val(), 10) - $repo.save(policy).then -> - $repo.save(policy).then null, -> + onSuccess = -> + $confirm.notify("success") + + onError = -> $confirm.notify("error") target.parents(".policy-table-row").find("input[value=#{prev_level}]").prop("checked", true) + $repo.save(policy).then(onSuccess, onError) + $scope.$on "$destroy", -> $el.off()