overleaf/services/web/public/coffee/ide/track-changes/controllers/TrackChangesDiffController.coffee

35 lines
888 B
CoffeeScript
Raw Normal View History

2014-07-08 11:02:26 +00:00
define [
"base"
], (App) ->
2014-07-11 12:55:14 +00:00
App.controller "TrackChangesDiffController", ($scope, $modal, ide) ->
2014-07-08 11:02:26 +00:00
$scope.restoreDeletedDoc = () ->
ide.trackChangesManager.restoreDeletedDoc(
$scope.trackChanges.diff.doc
)
2014-07-11 12:55:14 +00:00
$scope.openRestoreDiffModal = () ->
$modal.open {
templateUrl: "trackChangesRestoreDiffModalTemplate"
controller: "TrackChangesRestoreDiffModalController"
resolve:
diff: () -> $scope.trackChanges.diff
}
App.controller "TrackChangesRestoreDiffModalController", ($scope, $modalInstance, diff, ide) ->
$scope.state =
inflight: false
$scope.diff = diff
$scope.restore = () ->
$scope.state.inflight = true
ide.trackChangesManager
.restoreDiff(diff)
.success () ->
$scope.state.inflight = false
$modalInstance.close()
ide.editorManager.openDoc(diff.doc)
$scope.cancel = () ->
$modalInstance.dismiss()