mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-18 12:32:29 -05:00
46 lines
1.4 KiB
CoffeeScript
46 lines
1.4 KiB
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.controller "TrackChangesDiffController", ($scope, $modal, ide, event_tracking) ->
|
|
$scope.restoreDeletedDoc = () ->
|
|
event_tracking.sendMB "track-changes-restore-deleted"
|
|
$scope.trackChanges.diff.restoreInProgress = true
|
|
ide.trackChangesManager
|
|
.restoreDeletedDoc(
|
|
$scope.trackChanges.diff.doc
|
|
)
|
|
.success (response) ->
|
|
$scope.trackChanges.diff.restoredDocNewId = response.doc_id
|
|
$scope.trackChanges.diff.restoreInProgress = false
|
|
$scope.trackChanges.diff.restoreDeletedSuccess = true
|
|
|
|
$scope.openRestoreDiffModal = () ->
|
|
event_tracking.sendMB "track-changes-restore-modal"
|
|
$modal.open {
|
|
templateUrl: "trackChangesRestoreDiffModalTemplate"
|
|
controller: "TrackChangesRestoreDiffModalController"
|
|
resolve:
|
|
diff: () -> $scope.trackChanges.diff
|
|
}
|
|
|
|
$scope.backToEditorAfterRestore = () ->
|
|
ide.editorManager.openDoc({ id: $scope.trackChanges.diff.restoredDocNewId })
|
|
|
|
App.controller "TrackChangesRestoreDiffModalController", ($scope, $modalInstance, diff, ide, event_tracking) ->
|
|
$scope.state =
|
|
inflight: false
|
|
|
|
$scope.diff = diff
|
|
|
|
$scope.restore = () ->
|
|
event_tracking.sendMB "track-changes-restored"
|
|
$scope.state.inflight = true
|
|
ide.trackChangesManager
|
|
.restoreDiff(diff)
|
|
.success () ->
|
|
$scope.state.inflight = false
|
|
$modalInstance.close()
|
|
ide.editorManager.openDoc(diff.doc)
|
|
|
|
$scope.cancel = () ->
|
|
$modalInstance.dismiss()
|