mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-11 18:55:26 +00:00
Handle out of sync errors with a pop-up
This commit is contained in:
parent
e870d7190b
commit
b61da1a9f0
3 changed files with 37 additions and 17 deletions
|
@ -61,6 +61,17 @@ block content
|
|||
.ui-layout-east
|
||||
include ./editor/chat
|
||||
|
||||
script(type="text/ng-template", id="genericMessageModalTemplate")
|
||||
.modal-header
|
||||
button.close(
|
||||
type="button"
|
||||
data-dismiss="modal"
|
||||
ng-click="done()"
|
||||
) ×
|
||||
h3 {{ title }}
|
||||
.modal-body {{ message }}
|
||||
.modal-footer
|
||||
button.btn.btn-info(ng-click="done()") OK
|
||||
|
||||
script(src='/socket.io/socket.io.js')
|
||||
|
||||
|
|
|
@ -77,25 +77,17 @@ define [
|
|||
|
||||
_bindToDocumentEvents: (doc, sharejs_doc) ->
|
||||
sharejs_doc.on "error", (error) =>
|
||||
console.error "DOC ERROR", error
|
||||
@openDoc(doc, forceReopen: true)
|
||||
|
||||
#TODO!!!
|
||||
# Modal.createModal
|
||||
# title: "Out of sync"
|
||||
# message: "Sorry, this file has gone out of sync and we need to do a full refresh. Please let us know if this happens frequently."
|
||||
# buttons:[
|
||||
# text: "Ok"
|
||||
# ]
|
||||
@ide.showGenericMessageModal(
|
||||
"Out of sync"
|
||||
"Sorry, this file has gone out of sync and we need to do a full refresh. Please let us know if this happens frequently."
|
||||
)
|
||||
|
||||
sharejs_doc.on "externalUpdate", () =>
|
||||
#TODO!!!
|
||||
# Modal.createModal
|
||||
# title: "Document Updated Externally"
|
||||
# message: "This document was just updated externally. Any recent changes you have made may have been overwritten. To see previous versions please look in the history."
|
||||
# buttons:[
|
||||
# text: "Ok"
|
||||
# ]
|
||||
@ide.showGenericMessageModal(
|
||||
"Document Updated Externally"
|
||||
"This document was just updated externally. Any recent changes you have made may have been overwritten. To see previous versions please look in the history."
|
||||
)
|
||||
|
||||
_unbindFromDocumentEvents: (document) ->
|
||||
document.off()
|
||||
|
|
|
@ -3,7 +3,7 @@ define [
|
|||
], (App) ->
|
||||
# We create and provide this as service so that we can access the global ide
|
||||
# from within other parts of the angular app.
|
||||
App.factory "ide", ["$http", ($http) ->
|
||||
App.factory "ide", ["$http", "$modal", ($http, $modal) ->
|
||||
ide = {}
|
||||
ide.$http = $http
|
||||
|
||||
|
@ -16,5 +16,22 @@ define [
|
|||
ide.showGenericServerErrorMessage = () ->
|
||||
console.error "GENERIC SERVER ERROR MESSAGE STUB"
|
||||
|
||||
ide.showGenericMessageModal = (title, message) ->
|
||||
$modal.open {
|
||||
templateUrl: "genericMessageModalTemplate"
|
||||
controller: "GenericMessageModalController"
|
||||
resolve:
|
||||
title: -> title
|
||||
message: -> message
|
||||
}
|
||||
|
||||
return ide
|
||||
]
|
||||
|
||||
App.controller "GenericMessageModalController", ["$scope", "$modalInstance", "title", "message", ($scope, $modalInstance, title, message) ->
|
||||
$scope.title = title
|
||||
$scope.message = message
|
||||
|
||||
$scope.done = () ->
|
||||
$modalInstance.close()
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue