mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 00:16:46 -05:00
e035d526d6
Restructure frontend directories GitOrigin-RevId: 5a1224ca186f4809df45680a80d374c1c318d7bf
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
define(['base'], App => {
|
|
App.controller('ShareProjectModalMemberRowController', function(
|
|
$scope,
|
|
$modal,
|
|
projectMembers
|
|
) {
|
|
$scope.form = {
|
|
privileges: $scope.member.privileges,
|
|
|
|
isModified() {
|
|
return this.privileges !== $scope.member.privileges
|
|
},
|
|
|
|
submit() {
|
|
const userId = $scope.member._id
|
|
const privilegeLevel = $scope.form.privileges
|
|
if (privilegeLevel === 'owner') {
|
|
openOwnershipTransferConfirmModal(userId)
|
|
} else {
|
|
setPrivilegeLevel(userId, privilegeLevel)
|
|
}
|
|
},
|
|
|
|
reset() {
|
|
this.privileges = $scope.member.privileges
|
|
$scope.clearError()
|
|
}
|
|
}
|
|
|
|
function setPrivilegeLevel(userId, privilegeLevel) {
|
|
$scope.monitorRequest(
|
|
projectMembers
|
|
.setMemberPrivilegeLevel(userId, privilegeLevel)
|
|
.then(() => {
|
|
$scope.member.privileges = privilegeLevel
|
|
})
|
|
)
|
|
}
|
|
|
|
function openOwnershipTransferConfirmModal(userId) {
|
|
$modal.open({
|
|
templateUrl: 'ownershipTransferConfirmTemplate',
|
|
controller: 'OwnershipTransferConfirmModalController',
|
|
scope: $scope
|
|
})
|
|
}
|
|
})
|
|
})
|