Consolidate members list.

This commit is contained in:
Paulo Reis 2017-07-05 15:41:04 +01:00
parent 3f25c62496
commit 791da06e6e
2 changed files with 32 additions and 15 deletions

View file

@ -67,24 +67,30 @@
on-toggle="toggleTrackChangesForEveryone(isOn);"
disabled="!project.features.trackChanges || !permissions.write"
)
li.rp-tc-state-item
span.rp-tc-state-item-name.rp-tc-state-item-owner(
ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}"
style="color: hsl({{ users[project.owner._id].hue }}, 70%, 40%);"
) {{ users[project.owner._id].name }}
review-panel-toggle(
ng-model="reviewPanel.trackChangesState[project.owner._id].value"
on-toggle="toggleTrackChangesForUser(isOn, project.owner._id);"
disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges || !permissions.write"
)
li.rp-tc-state-item(ng-repeat="member in project.members | filter:{ privileges: 'readAndWrite' }")
//- li.rp-tc-state-item(
//- ng-init="formattedOwner = formatUser(project.owner);"
//- )
//- pre {{ project.owner | json }}
//- pre {{ formattedOwner | json }}
//- span.rp-tc-state-item-name.rp-tc-state-item-owner(
//- ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}"
//- style="color: hsl({{ formattedOwner.hue }}, 70%, 40%);"
//- ) {{ formattedOwner.name }}
//- review-panel-toggle(
//- ng-model="reviewPanel.trackChangesState[formattedOwner.id].value"
//- on-toggle="toggleTrackChangesForUser(isOn, formattedOwner.id);"
//- disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges || !permissions.write"
//- )
li.rp-tc-state-item(
ng-repeat="member in reviewPanel.formattedProjectMembers"
)
span.rp-tc-state-item-name(
ng-class="{ 'rp-tc-state-item-name-disabled' : reviewPanel.trackChangesOnForEveryone}"
style="color: hsl({{ users[member._id].hue }}, 70%, 40%);"
) {{ users[member._id].name }}
style="color: hsl({{ member.hue }}, 70%, 40%);"
) {{ member.name }}
review-panel-toggle(
ng-model="reviewPanel.trackChangesState[member._id].value"
on-toggle="toggleTrackChangesForUser(isOn, member._id);"
ng-model="reviewPanel.trackChangesState[member.id].value"
on-toggle="toggleTrackChangesForUser(isOn, member.id);"
disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges || !permissions.write"
)

View file

@ -33,6 +33,7 @@ define [
commentThreads: {}
resolvedThreadIds: {}
rendererData: {}
formattedProjectMembers: {}
fullTCStateCollapsed: true
loadingThreads: false
# All selected changes. If a aggregated change (insertion + deletion) is selection, the two ids
@ -68,6 +69,15 @@ define [
if !visible
$scope.ui.reviewPanelOpen = false
$scope.$watch "project.members", (members) ->
$scope.reviewPanel.formattedProjectMembers = {}
if $scope.project?.owner?
$scope.reviewPanel.formattedProjectMembers[$scope.project.owner._id] = formatUser($scope.project.owner)
if $scope.project?.members?
for member in members
if member.privileges == "readAndWrite"
$scope.reviewPanel.formattedProjectMembers[member._id] = formatUser(member)
$scope.commentState =
adding: false
content: ""
@ -647,6 +657,7 @@ define [
return if _inited
project = ide.$scope.project
if project.features.trackChanges
window.trackChangesState ?= false
applyTrackChangesStateToClient(window.trackChangesState)
else
applyTrackChangesStateToClient(false)