Show an error message when delete a member on error
parent
8150653e31
commit
57bde2886a
|
@ -265,7 +265,7 @@ MembershipsRowAdminCheckboxDirective = ($log, $repo, $confirm) ->
|
||||||
template = _.template("""
|
template = _.template("""
|
||||||
<input type="checkbox" id="<%- inputId %>" />
|
<input type="checkbox" id="<%- inputId %>" />
|
||||||
<label for="<%- inputId %>">Is admin?</label>
|
<label for="<%- inputId %>">Is admin?</label>
|
||||||
""") # i18n
|
""") # TODO: i18n
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
render = (member) ->
|
render = (member) ->
|
||||||
|
@ -370,7 +370,7 @@ MembershipsRowActionsDirective = ($log, $repo, $rs, $confirm) ->
|
||||||
<a class="delete" href="">
|
<a class="delete" href="">
|
||||||
<span class="icon icon-delete"></span>
|
<span class="icon icon-delete"></span>
|
||||||
</a>
|
</a>
|
||||||
""") # i18n
|
""") # TODO: i18n
|
||||||
|
|
||||||
pendingTemplate = _.template("""
|
pendingTemplate = _.template("""
|
||||||
<a class="pending" href="">
|
<a class="pending" href="">
|
||||||
|
@ -380,7 +380,7 @@ MembershipsRowActionsDirective = ($log, $repo, $rs, $confirm) ->
|
||||||
<a class="delete" href="" title="Delete">
|
<a class="delete" href="" title="Delete">
|
||||||
<span class="icon icon-delete"></span>
|
<span class="icon icon-delete"></span>
|
||||||
</a>
|
</a>
|
||||||
""") # i18n
|
""") # TODO: i18n
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
render = (member) ->
|
render = (member) ->
|
||||||
|
@ -401,23 +401,29 @@ MembershipsRowActionsDirective = ($log, $repo, $rs, $confirm) ->
|
||||||
$el.on "click", ".pending", (event) ->
|
$el.on "click", ".pending", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
onSuccess = ->
|
onSuccess = ->
|
||||||
# i18n
|
# TODO: i18n
|
||||||
$confirm.notify("success", "We've sent the invitationi again to '#{$scope.member.email}'.")
|
$confirm.notify("success", "We've sent the invitationi again to '#{$scope.member.email}'.")
|
||||||
onError = ->
|
onError = ->
|
||||||
$confirm.notify("error", "We haven't sent the invitation.") # i18n
|
$confirm.notify("error", "We haven't sent the invitation.") # TODO: i18n
|
||||||
|
|
||||||
$rs.memberships.resendInvitation($scope.member.id).then(onSuccess, onError)
|
$rs.memberships.resendInvitation($scope.member.id).then(onSuccess, onError)
|
||||||
|
|
||||||
$el.on "click", ".delete", (event) ->
|
$el.on "click", ".delete", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
title = "Delete member" # i18n
|
title = "Delete member" # TODO: i18n
|
||||||
subtitle = if member.user then member.full_name else "the invitation to #{member.email}" # i18n
|
subtitle = if member.user then member.full_name else "the invitation to #{member.email}" # TODO: i18n
|
||||||
|
|
||||||
|
onSuccess = ->
|
||||||
|
$ctrl.loadMembers()
|
||||||
|
$confirm.notify("success", null, "We've deleted #{subtitle}.") # TODO: i18n
|
||||||
|
|
||||||
|
onError = ->
|
||||||
|
# TODO: i18in
|
||||||
|
$confirm.notify("error", null, "We have not been able to delete #{subtitle}.")
|
||||||
|
|
||||||
$confirm.ask(title, subtitle).then ->
|
$confirm.ask(title, subtitle).then ->
|
||||||
$repo.remove(member).then ->
|
$repo.remove(member).then(onSuccess, onError)
|
||||||
$ctrl.loadMembers()
|
|
||||||
$confirm.notify("success", null, "We've deleted #{subtitle}.") # i18n
|
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
Loading…
Reference in New Issue