X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/f61fd6fa1d5871782b079ee50fb6bb10777cadc2..73a6ba2accc1ac01c6a525a477f7c99c6ee4f3e6:/modules/data/data.js?ds=inline diff --git a/modules/data/data.js b/modules/data/data.js index 9b2b0cb..e2cdbb1 100644 --- a/modules/data/data.js +++ b/modules/data/data.js @@ -102,6 +102,25 @@ return function(sandbox) { sandbox.publish('diffFetched', {table: data, ver1: ver1, ver2: ver2}) }, }); + }, + restoreVersion: function(options) { + if(options.version && options.description) { + sandbox.publish('restoringStarted', {version: options.version}); + $.ajax({ + method: 'post', + dataType: 'json', + url: '/' + gettext('editor') + '/' + document_id + '/revert', + data: JSON.stringify(options), + success: function(data) { + doc = data.document; + reloadHistory(); + sandbox.publish('documentReverted', {document: data.document, version: data.version}); + }, + }); + } + }, + getDocumentId: function() { + return document_id; } } };