Saving and restoring local draft of a document
[fnpeditor.git] / src / editor / modules / rng / rng.js
index fc97f99..801473b 100644 (file)
@@ -43,6 +43,7 @@ return function(sandbox) {
             sandbox.getModule('nodeFamilyTree').setElement(nodeElement);
             sandbox.getModule('nodeBreadCrumbs').setNodeElement(nodeElement);
             sandbox.getModule('documentToolbar').setNodeElement(nodeElement);
+            sandbox.getModule('metadataEditor').setNodeElement(nodeElement);
         },
         updateCurrentTextElement: function(textElement) {
             sandbox.getModule('nodeFamilyTree').setElement(textElement);
@@ -98,15 +99,23 @@ return function(sandbox) {
                 documentIsDirty = true;
             });
         },
-        savingStarted: function() {
+        savingStarted: function(what) {
+            var msg = {
+                remote: gettext('Saving document'),
+                local: gettext('Saving local copy')
+            };
             sandbox.getModule('mainBar').setCommandEnabled('save', false);
-            sandbox.getModule('indicator').showMessage(gettext('Saving...'));
+            sandbox.getModule('indicator').showMessage(msg[what] + '...');
         },
-        savingEnded: function(status, current_version) {
+        savingEnded: function(status, what, current_version) {
             void(status);
+            var msg = {
+                remote: gettext('Document saved'),
+                local: gettext('Local copy saved')
+            };
             documentIsDirty = false;
             sandbox.getModule('mainBar').setCommandEnabled('save', true);
-            sandbox.getModule('indicator').clearMessage({message:'Dokument zapisany'});
+            sandbox.getModule('indicator').clearMessage({message: msg[what]});
             sandbox.getModule('mainBar').setVersion(current_version);
         },
         restoringStarted: function(event) {