editor: Inserting document templates support
[fnpeditor.git] / src / editor / modules / rng / rng.js
index b1e091c..a5432c0 100644 (file)
@@ -42,18 +42,10 @@ return function(sandbox) {
             sandbox.getModule('nodePane').setNodeElement(nodeElement);
             sandbox.getModule('nodeFamilyTree').setElement(nodeElement);
             sandbox.getModule('nodeBreadCrumbs').setNodeElement(nodeElement);
+            sandbox.getModule('documentToolbar').setNodeElement(nodeElement);
         },
         updateCurrentTextElement: function(textElement) {
             sandbox.getModule('nodeFamilyTree').setElement(textElement);
-        },
-        resetDocument: function(document, reason) {
-            var modules = [];
-            if (reason === 'revert') {
-                modules = ['documentCanvas', 'metadataEditor', 'sourceEditor'];
-            }
-            modules.forEach(function(moduleName) {
-                sandbox.getModule(moduleName).setDocument(document);
-            });
         }
     };
     
@@ -100,10 +92,11 @@ return function(sandbox) {
             sandbox.getModule('mainBar').setCommandEnabled('save', false);
             sandbox.getModule('indicator').showMessage(gettext('Saving...'));
         },
-        savingEnded: function(status) {
+        savingEnded: function(status, current_version) {
             void(status);
             sandbox.getModule('mainBar').setCommandEnabled('save', true);
             sandbox.getModule('indicator').clearMessage({message:'Dokument zapisany'});
+            sandbox.getModule('mainBar').setVersion(current_version);
         },
         restoringStarted: function(event) {
             sandbox.getModule('mainBar').setCommandEnabled('save', false);
@@ -116,7 +109,6 @@ return function(sandbox) {
             sandbox.getModule('diffViewer').setDiff(diff);
         },
         documentReverted: function(event) {
-            commands.resetDocument(event.document, 'revert');
             sandbox.getModule('mainBar').setCommandEnabled('save', true);
             sandbox.getModule('indicator').clearMessage({message:'Wersja ' + event.reverted_version + ' przywrócona'});
             sandbox.getModule('mainBar').setVersion(event.current_version);
@@ -236,6 +228,7 @@ return function(sandbox) {
             sandbox.getModule('data').restoreVersion(event);
         },
         displayVersion: function(event) {
+            /* globals window */
             window.open('/' + gettext('editor') + '/' + sandbox.getModule('data').getDocumentId() + '?version=' + event.version, _.uniqueId());
         }
     };