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

35 lines
888 B
CoffeeScript
Raw Normal View History

2014-07-08 07:02:26 -04:00
define [
"base"
], (App) ->
2014-07-11 08:55:14 -04:00
App.controller "TrackChangesDiffController", ($scope, $modal, ide) ->
2014-07-08 07:02:26 -04:00
$scope.restoreDeletedDoc = () ->
ide.trackChangesManager.restoreDeletedDoc(
$scope.trackChanges.diff.doc
)
2014-07-11 08:55:14 -04: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()