mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
UI fix - do not allow multiple clicks to restore a deleted file.
This commit is contained in:
parent
216779fafe
commit
cf5c8e27e1
5 changed files with 36 additions and 8 deletions
|
@ -143,15 +143,27 @@ div#trackChanges(ng-show="ui.view == 'track-changes'")
|
|||
navigate-highlights="true"
|
||||
)
|
||||
.diff-deleted.text-centered(
|
||||
ng-show="trackChanges.diff.deleted"
|
||||
ng-show="trackChanges.diff.deleted && !trackChanges.diff.restoreDeletedSuccess"
|
||||
)
|
||||
p.text-serif #{translate("file_has_been_deleted", {filename:"{{ trackChanges.diff.doc.name }} "})}
|
||||
|
||||
p
|
||||
a.btn.btn-primary.btn-lg(
|
||||
href,
|
||||
ng-click="restoreDeletedDoc()"
|
||||
ng-click="restoreDeletedDoc()",
|
||||
ng-disabled="trackChanges.diff.restoreInProgress"
|
||||
) #{translate("restore")}
|
||||
|
||||
.diff-deleted.text-centered(
|
||||
ng-show="trackChanges.diff.deleted && trackChanges.diff.restoreDeletedSuccess"
|
||||
)
|
||||
p.text-serif Your file ({{ trackChanges.diff.doc.name }}) has been recovered.
|
||||
p.text-serif You can go back to the editor and work on it again.
|
||||
p
|
||||
a.btn.btn-default(
|
||||
href,
|
||||
ng-click="backToEditorAfterRestore()",
|
||||
) Back to editor
|
||||
|
||||
.loading-panel(ng-show="trackChanges.diff.loading")
|
||||
i.fa.fa-spin.fa-refresh
|
||||
| #{translate("loading")}...
|
||||
|
|
|
@ -117,6 +117,9 @@ define [
|
|||
diff.error = true
|
||||
else
|
||||
diff.deleted = true
|
||||
diff.restoreInProgress = false
|
||||
diff.restoreDeletedSuccess = false
|
||||
diff.restoredDocNewId = null
|
||||
|
||||
restoreDeletedDoc: (doc) ->
|
||||
url = "/project/#{@$scope.project_id}/doc/#{doc.id}/restore"
|
||||
|
|
|
@ -4,9 +4,15 @@ define [
|
|||
App.controller "TrackChangesDiffController", ($scope, $modal, ide, event_tracking) ->
|
||||
$scope.restoreDeletedDoc = () ->
|
||||
event_tracking.sendCountly "track-changes-restore-deleted"
|
||||
ide.trackChangesManager.restoreDeletedDoc(
|
||||
$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.sendCountly "track-changes-restore-modal"
|
||||
|
@ -17,6 +23,9 @@ define [
|
|||
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
|
||||
|
|
|
@ -2,7 +2,7 @@ define [
|
|||
"base"
|
||||
], (App) ->
|
||||
|
||||
App.controller "TrackChangesPremiumPopup", ($scope, ide, sixpack, event_tracking)->
|
||||
App.controller "TrackChangesPremiumPopup", ($scope, ide, sixpack)->
|
||||
$scope.$watch "ui.view", ->
|
||||
if $scope.ui.view == "track-changes"
|
||||
if $scope.project?.features?.versioning
|
||||
|
@ -78,7 +78,7 @@ define [
|
|||
$scope.recalculateSelectedUpdates()
|
||||
]
|
||||
|
||||
App.controller "TrackChangesListItemController", ["$scope", ($scope) ->
|
||||
App.controller "TrackChangesListItemController", ["$scope", "event_tracking", ($scope, event_tracking) ->
|
||||
$scope.$watch "update.selectedFrom", (selectedFrom, oldSelectedFrom) ->
|
||||
if selectedFrom
|
||||
for update in $scope.trackChanges.updates
|
||||
|
|
|
@ -267,6 +267,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.diff-deleted {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.editor-dark {
|
||||
#trackChanges {
|
||||
aside.change-list {
|
||||
|
|
Loading…
Reference in a new issue