Show simpler UI when there is only one user.

This commit is contained in:
Paulo Reis 2017-07-05 16:04:02 +01:00
parent 139c2ab1fd
commit dae5381af7
2 changed files with 20 additions and 3 deletions

View file

@ -51,14 +51,22 @@
ng-if="editor.wantTrackChanges === true"
)
i.fa.fa-circle
span(ng-click="toggleFullTCStateCollapse();", ng-if="editor.wantTrackChanges === false") !{translate("track_changes_is_off")}
span(ng-click="toggleFullTCStateCollapse();", ng-if="editor.wantTrackChanges === true") !{translate("track_changes_is_on")}
span(ng-click="handleTrackChangesStateClick();", ng-if="editor.wantTrackChanges === false") !{translate("track_changes_is_off")}
span(ng-click="handleTrackChangesStateClick();", ng-if="editor.wantTrackChanges === true") !{translate("track_changes_is_on")}
span.rp-tc-state-collapse(
ng-if="reviewPanel.isMultiUser"
ng-class="{ 'rp-tc-state-collapse-on': reviewPanel.fullTCStateCollapsed }"
)
i.fa.fa-angle-down
review-panel-toggle(
ng-if="!reviewPanel.isMultiUser"
ng-model="reviewPanel.trackChangesOnForEveryone"
on-toggle="toggleTrackChangesForEveryone(isOn);"
disabled="!project.features.trackChanges || !permissions.write"
)
ul.rp-tc-state(
review-panel-collapse-height="reviewPanel.fullTCStateCollapsed"
ng-if="reviewPanel.isMultiUser"
)
li.rp-tc-state-item.rp-tc-state-item-everyone
span.rp-tc-state-item-name Everyone

View file

@ -34,6 +34,7 @@ define [
resolvedThreadIds: {}
rendererData: {}
formattedProjectMembers: {}
isMultiUser: false
fullTCStateCollapsed: true
loadingThreads: false
# All selected changes. If a aggregated change (insertion + deletion) is selection, the two ids
@ -71,11 +72,13 @@ define [
$scope.$watch "project.members", (members) ->
$scope.reviewPanel.formattedProjectMembers = {}
$scope.reviewPanel.isMultiUser = false
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.isMultiUser = true
$scope.reviewPanel.formattedProjectMembers[member._id] = formatUser(member)
$scope.commentState =
@ -585,6 +588,12 @@ define [
$scope.gotoEntry = (doc_id, entry) ->
ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset })
$scope.handleTrackChangesStateClick = () ->
if $scope.reviewPanel.isMultiUser
$scope.toggleFullTCStateCollapse()
else
$scope.toggleTrackChangesForEveryone()
$scope.toggleFullTCStateCollapse = () ->
if $scope.project.features.trackChanges
reviewPanel.fullTCStateCollapsed = !reviewPanel.fullTCStateCollapsed
@ -633,7 +642,7 @@ define [
_setUserTCState(member._id, state[member._id] ? false)
_setUserTCState($scope.project.owner._id, state[$scope.project.owner._id] ? false)
$scope.toggleTrackChangesForEveryone = (onForEveryone) ->
$scope.toggleTrackChangesForEveryone = (onForEveryone = !reviewPanel.trackChangesOnForEveryone) ->
_setEveryoneTCState onForEveryone, true
applyClientTrackChangesStateToServer()