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 = () ->
|
2016-08-03 07:17:19 -04:00
|
|
|
console.log("track-changes-restore-modal")
|
2014-07-11 08:55:14 -04:00
|
|
|
$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 = () ->
|
2016-08-03 07:17:19 -04:00
|
|
|
console.log("track-changes-restored")
|
2014-07-11 08:55:14 -04:00
|
|
|
$scope.state.inflight = true
|
|
|
|
ide.trackChangesManager
|
|
|
|
.restoreDiff(diff)
|
|
|
|
.success () ->
|
|
|
|
$scope.state.inflight = false
|
|
|
|
$modalInstance.close()
|
|
|
|
ide.editorManager.openDoc(diff.doc)
|
|
|
|
|
|
|
|
$scope.cancel = () ->
|
|
|
|
$modalInstance.dismiss()
|