Delete a member
parent
a8c0d38a7b
commit
3d28459471
|
@ -43,8 +43,9 @@ class MembershipsController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @rootScope, @repo, @confirm, @rs, @params, @q, @location) ->
|
constructor: (@scope, @rootScope, @repo, @confirm, @rs, @params, @q, @location) ->
|
||||||
|
@scope.sectionName = "Memberships" #i18n
|
||||||
|
@scope.project = {}
|
||||||
@scope.filters = {}
|
@scope.filters = {}
|
||||||
@scope.sectionName = "Memberships"
|
|
||||||
|
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
|
@ -251,7 +252,7 @@ module.directive("tgMembershipsMemberAvatar", ["$log", MembershipsMemberAvatarDi
|
||||||
## Member Actions Directive
|
## Member Actions Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
MembershipsMemberActionsDirective = ($log) ->
|
MembershipsMemberActionsDirective = ($log, $repo, $confirm) ->
|
||||||
activedTemplate = _.template("""
|
activedTemplate = _.template("""
|
||||||
<div class="active">
|
<div class="active">
|
||||||
Active
|
Active
|
||||||
|
@ -265,7 +266,7 @@ MembershipsMemberActionsDirective = ($log) ->
|
||||||
Pending
|
Pending
|
||||||
<span class="icon icon-reload"></span>
|
<span class="icon icon-reload"></span>
|
||||||
</a>
|
</a>
|
||||||
<a class="delete" href="">
|
<a class="delete" href="" title="Delete">
|
||||||
<span class="icon icon-delete"></span>
|
<span class="icon icon-delete"></span>
|
||||||
</a>
|
</a>
|
||||||
""") # i18n
|
""") # i18n
|
||||||
|
@ -276,6 +277,8 @@ MembershipsMemberActionsDirective = ($log) ->
|
||||||
return pendingTemplate()
|
return pendingTemplate()
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
|
$ctrl = $el.controller()
|
||||||
|
|
||||||
if not $attrs.tgMembershipsMemberActions?
|
if not $attrs.tgMembershipsMemberActions?
|
||||||
return $log.error "MembershipsMemberActionsDirective: the directive need a member"
|
return $log.error "MembershipsMemberActionsDirective: the directive need a member"
|
||||||
|
|
||||||
|
@ -283,13 +286,30 @@ MembershipsMemberActionsDirective = ($log) ->
|
||||||
html = render(member)
|
html = render(member)
|
||||||
$el.html(html)
|
$el.html(html)
|
||||||
|
|
||||||
|
$el.on "click", ".pending", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
#TODO: Re-send the invitation
|
||||||
|
console.log "re-sending the invitation to #{member.email}"
|
||||||
|
|
||||||
|
$el.on "click", ".delete", (event) ->
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
title = "Delete member" # i18n
|
||||||
|
subtitle = if member.user then member.full_name else "the invitation to #{member.email}" # i18n
|
||||||
|
|
||||||
|
$confirm.ask(title, subtitle).then ->
|
||||||
|
$repo.remove(member).then ->
|
||||||
|
$ctrl.loadMembers()
|
||||||
|
$confirm.notify("success", null, "We've deleted #{subtitle}.") # i18n
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
return {link: link}
|
return {link: link}
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgMembershipsMemberActions", ["$log", MembershipsMemberActionsDirective])
|
module.directive("tgMembershipsMemberActions", ["$log", "$tgRepo", "$tgConfirm",
|
||||||
|
MembershipsMemberActionsDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
Loading…
Reference in New Issue