Show a confirm message when a project notification is changed

stable
David Barragán Merino 2014-09-03 17:53:39 +02:00
parent 3b452ea279
commit ea53e08a21
1 changed files with 6 additions and 2 deletions

View File

@ -143,11 +143,15 @@ UserNotificationsListDirective = ($repo, $confirm) ->
prev_level = policy.notify_level prev_level = policy.notify_level
policy.notify_level = parseInt(target.val(), 10) policy.notify_level = parseInt(target.val(), 10)
$repo.save(policy).then -> onSuccess = ->
$repo.save(policy).then null, -> $confirm.notify("success")
onError = ->
$confirm.notify("error") $confirm.notify("error")
target.parents(".policy-table-row").find("input[value=#{prev_level}]").prop("checked", true) target.parents(".policy-table-row").find("input[value=#{prev_level}]").prop("checked", true)
$repo.save(policy).then(onSuccess, onError)
$scope.$on "$destroy", -> $scope.$on "$destroy", ->
$el.off() $el.off()