mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 10:03:10 +00:00
Wire up TC widget to controller methods.
This commit is contained in:
parent
dc2085c6e1
commit
1fa7338baf
3 changed files with 12 additions and 13 deletions
|
@ -56,7 +56,7 @@
|
|||
span.rp-tc-state-item-name.rp-tc-state-item-name-everyone Everyone
|
||||
review-panel-toggle(
|
||||
ng-model="reviewPanel.trackChangesOnForEveryone"
|
||||
on-toggle="toggleTrackChangesForEveryone"
|
||||
on-toggle="toggleTrackChangesForEveryone(isOn);"
|
||||
disabled="!project.features.trackChanges"
|
||||
on-disabled-click="openTrackChangesUpgradeModal"
|
||||
)
|
||||
|
@ -69,8 +69,7 @@
|
|||
//- method, and it's not clear how.
|
||||
review-panel-toggle(
|
||||
ng-model="reviewPanel.trackChangesState[user.id]"
|
||||
disabled="!project.features.trackChanges"
|
||||
on-disabled-click="openTrackChangesUpgradeModal"
|
||||
on-toggle="toggleTrackChangesForUser(isOn, user.id);"
|
||||
)
|
||||
li.rp-tc-state-item(ng-repeat="member in project.members")
|
||||
span.rp-tc-state-item-name(
|
||||
|
@ -79,8 +78,7 @@
|
|||
//- {{member._id}}
|
||||
review-panel-toggle(
|
||||
ng-model="reviewPanel.trackChangesState[member._id]"
|
||||
disabled="!project.features.trackChanges"
|
||||
on-disabled-click="openTrackChangesUpgradeModal"
|
||||
on-toggle="toggleTrackChangesForUser(isOn, member._id);"
|
||||
)
|
||||
|
||||
//- span.review-panel-toolbar-label(ng-if="permissions.write")
|
||||
|
|
|
@ -610,14 +610,15 @@ define [
|
|||
$scope.toggleTrackChangesForEveryone = (onForEveryone) ->
|
||||
console.log "[toggleTrackChangesForEveryone]", onForEveryone
|
||||
setTrackChangesState(onForEveryone)
|
||||
|
||||
|
||||
|
||||
window.toggleTrackChangesForUser = # DEBUG LINE
|
||||
$scope.toggleTrackChangesForUser = (user_id) ->
|
||||
$scope.toggleTrackChangesForUser = (onForUser, userId) ->
|
||||
console.log "[toggleTrackChangesForUser]", onForUser, userId
|
||||
state = $scope.reviewPanel.trackChangesState
|
||||
if state[user_id]?
|
||||
delete state[user_id]
|
||||
else
|
||||
state[user_id] = true
|
||||
state[userId] = onForUser
|
||||
if state[user_id] == false
|
||||
delete state[userId]
|
||||
setTrackChangesState(state)
|
||||
|
||||
ide.socket.on "toggle-track-changes", (state) ->
|
||||
|
|
|
@ -4,7 +4,7 @@ define [
|
|||
App.directive "reviewPanelToggle", () ->
|
||||
restrict: "E"
|
||||
scope:
|
||||
onToggle: '='
|
||||
onToggle: '&'
|
||||
ngModel: '='
|
||||
disabled: '=?'
|
||||
onDisabledClick: '=?'
|
||||
|
@ -12,7 +12,7 @@ define [
|
|||
if !scope.disabled?
|
||||
scope.disabled = false
|
||||
scope.onChange = (args...) ->
|
||||
scope.onToggle(scope.localModel)
|
||||
scope.onToggle({ isOn: scope.localModel })
|
||||
scope.handleClick = () ->
|
||||
if scope.disabled
|
||||
scope.onDisabledClick()
|
||||
|
|
Loading…
Reference in a new issue