Readd feature flag handling.

This commit is contained in:
Paulo Reis 2017-07-05 11:08:14 +01:00
parent 2f7fde8341
commit c227a61ac6
3 changed files with 9 additions and 5 deletions

View file

@ -65,6 +65,7 @@
review-panel-toggle(
ng-model="reviewPanel.trackChangesOnForEveryone"
on-toggle="toggleTrackChangesForEveryone(isOn);"
disabled="!project.features.trackChanges"
)
//- disabled="!project.features.trackChanges"
//- on-disabled-click="openTrackChangesUpgradeModal"
@ -76,7 +77,7 @@
review-panel-toggle(
ng-model="reviewPanel.trackChangesState[project.owner._id].value"
on-toggle="toggleTrackChangesForUser(isOn, project.owner._id);"
disabled="reviewPanel.trackChangesOnForEveryone"
disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges"
)
li.rp-tc-state-item(ng-repeat="member in project.members")
span.rp-tc-state-item-name(
@ -86,7 +87,7 @@
review-panel-toggle(
ng-model="reviewPanel.trackChangesState[member._id].value"
on-toggle="toggleTrackChangesForUser(isOn, member._id);"
disabled="reviewPanel.trackChangesOnForEveryone"
disabled="reviewPanel.trackChangesOnForEveryone || !project.features.trackChanges"
)
//- span.review-panel-toolbar-label(ng-if="permissions.write")

View file

@ -575,7 +575,10 @@ define [
ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset })
$scope.toggleFullTCStateCollapse = () ->
reviewPanel.fullTCStateCollapsed = !reviewPanel.fullTCStateCollapsed
if $scope.project.features.trackChanges
reviewPanel.fullTCStateCollapsed = !reviewPanel.fullTCStateCollapsed
else
$scope.openTrackChangesUpgradeModal()
_setUserTCState = (userId, newValue, isLocal = false) ->
$scope.reviewPanel.trackChangesState[userId] ?= {}

View file

@ -8,14 +8,14 @@ define [
ngModel: '='
valWhenUndefined: '=?'
disabled: '=?'
onDisabledClick: '=?'
onDisabledClick: '&?'
link: (scope) ->
if !scope.disabled?
scope.disabled = false
scope.onChange = (args...) ->
scope.onToggle({ isOn: scope.localModel })
scope.handleClick = () ->
if scope.disabled
if scope.disabled and scope.onDisabledClick?
scope.onDisabledClick()
scope.localModel = scope.ngModel
scope.$watch "ngModel", (value) ->