team leave project
parent
8516da6c95
commit
dc008d7757
|
@ -697,3 +697,15 @@ AttachmentPreviewLightboxDirective = (lightboxService, $template, $compile) ->
|
|||
}
|
||||
|
||||
module.directive("tgLbAttachmentPreview", ["lightboxService", "$tgTemplate", "$compile", AttachmentPreviewLightboxDirective])
|
||||
|
||||
LightboxLeaveProjectWarningDirective = (lightboxService, $template, $compile) ->
|
||||
link = ($scope, $el, attrs) ->
|
||||
lightboxService.open($el)
|
||||
|
||||
return {
|
||||
templateUrl: 'common/lightbox/lightbox-leave-project-warning.html',
|
||||
link: link,
|
||||
scope: true
|
||||
}
|
||||
|
||||
module.directive("tgLightboxLeaveProjectWarning", ["lightboxService", LightboxLeaveProjectWarningDirective])
|
||||
|
|
|
@ -184,7 +184,7 @@ TeamMemberCurrentUserDirective = () ->
|
|||
return {
|
||||
templateUrl: "team/team-member-current-user.html"
|
||||
scope: {
|
||||
projectId: "=projectid",
|
||||
project: "=project",
|
||||
currentUser: "=currentuser",
|
||||
stats: "=",
|
||||
issuesEnabled: "=issuesenabled",
|
||||
|
@ -225,14 +225,14 @@ module.directive("tgTeamMembers", TeamMembersDirective)
|
|||
## Leave project Directive
|
||||
#############################################################################
|
||||
|
||||
LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate) ->
|
||||
LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate, lightboxFactory, currentUserService) ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
$scope.leave = () ->
|
||||
leaveConfirm = () ->
|
||||
leave_project_text = $translate.instant("TEAM.ACTION_LEAVE_PROJECT")
|
||||
confirm_leave_project_text = $translate.instant("TEAM.CONFIRM_LEAVE_PROJECT")
|
||||
|
||||
$confirm.ask(leave_project_text, confirm_leave_project_text).then (response) =>
|
||||
promise = $rs.projects.leave($attrs.projectid)
|
||||
promise = $rs.projects.leave($scope.project.id)
|
||||
|
||||
promise.then =>
|
||||
response.finish()
|
||||
|
@ -243,13 +243,29 @@ LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate)
|
|||
response.finish()
|
||||
$confirm.notify('error', response.data._error_message)
|
||||
|
||||
$scope.leave = () ->
|
||||
if $scope.project.owner.id == $scope.user.id
|
||||
currentUser = currentUserService.getUser()
|
||||
|
||||
lightboxFactory.create("tg-lightbox-leave-project-warning", {
|
||||
class: "lightbox lightbox-leave-project-warning"
|
||||
}, {
|
||||
currentUser: true,
|
||||
project: $scope.project
|
||||
})
|
||||
else
|
||||
leaveConfirm()
|
||||
|
||||
return {
|
||||
scope: {},
|
||||
scope: {
|
||||
user: "=",
|
||||
project: "="
|
||||
},
|
||||
templateUrl: "team/leave-project.html",
|
||||
link: link
|
||||
}
|
||||
|
||||
module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", "$translate",
|
||||
module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", "$translate", "tgLightboxFactory", "tgCurrentUserService",
|
||||
LeaveProjectDirective])
|
||||
|
||||
|
||||
|
|
|
@ -919,6 +919,17 @@
|
|||
"CREATE_MEMBER": {
|
||||
"PLACEHOLDER_INVITATION_TEXT": "(Optional) Add a personalized text to the invitation. Tell something lovely to your new members ;-)",
|
||||
"PLACEHOLDER_TYPE_EMAIL": "Type an Email"
|
||||
},
|
||||
"LEAVE_PROJECT_WARNING": {
|
||||
"TITLE": "You can not leave the project without owner",
|
||||
"CURRENT_USER_OWNER": {
|
||||
"DESC": "You are the project owner before leaving it you must pass the property to someone else.",
|
||||
"BUTTON": "Change the project owner"
|
||||
},
|
||||
"OTHER_USER_OWNER": {
|
||||
"DESC": "You can't delete the project owner, you must request a new owner before deleting the user.",
|
||||
"BUTTON": "Request change project owner"
|
||||
}
|
||||
}
|
||||
},
|
||||
"US": {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
svg.close.icon.icon-close(href="", title="{{'COMMON.CLOSE' | translate}}")
|
||||
use(xlink:href="#icon-close")
|
||||
div.content
|
||||
svg.icon.icon-exclamation
|
||||
use(xlink:href="#icon-exclamation")
|
||||
|
||||
h2.title {{'LIGHTBOX.LEAVE_PROJECT_WARNING.TITLE' | translate}}
|
||||
|
||||
div(ng-if="currentUser")
|
||||
p {{'LIGHTBOX.LEAVE_PROJECT_WARNING.CURRENT_USER_OWNER.DESC' | translate}}
|
||||
|
||||
a.button-green(tg-nav="project-admin-home:project=project.slug", href="")
|
||||
span(translate="LIGHTBOX.LEAVE_PROJECT_WARNING.CURRENT_USER_OWNER.BUTTON")
|
||||
|
||||
div(ng-if="!currentUser")
|
||||
p {{'LIGHTBOX.LEAVE_PROJECT_WARNING.OTHER_USER_OWNER.DESC' | translate}}
|
||||
|
||||
a.button-green(tg-nav="project-admin-home:project=project.slug", href="")
|
||||
span(translate="LIGHTBOX.LEAVE_PROJECT_WARNING.OTHER_USER_OWNER.BUTTON")
|
|
@ -31,7 +31,7 @@ section.table-team.basic-table
|
|||
tg-team-current-user
|
||||
stats="stats"
|
||||
currentuser="currentUser"
|
||||
projectid="projectId"
|
||||
project="project"
|
||||
issuesEnabled="issuesEnabled"
|
||||
tasksenabled="tasksEnabled"
|
||||
wikienabled="wikiEnabled"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
.position(tg-bo-bind="currentUser.role_name")
|
||||
|
||||
div(tg-leave-project="", projectid="{{projectId}}")
|
||||
div(tg-leave-project="", project="project", user="currentUser")
|
||||
|
||||
.member-stats(
|
||||
tg-team-member-stats
|
||||
|
|
|
@ -552,3 +552,16 @@
|
|||
height: 5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.lightbox-leave-project-warning {
|
||||
text-align: center;
|
||||
.icon {
|
||||
fill: $gray-light;
|
||||
height: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
width: 3rem;
|
||||
}
|
||||
.content {
|
||||
width: 500px;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue