- savingEnded: function(status) {
- sandbox.getModule('mainBar').setCommandEnabled('save', true);
- sandbox.getModule('indicator').clearMessage({message:'Dokument zapisany'});
+ savingStarted: function(what) {
+ var msg = {
+ remote: gettext('Saving document'),
+ local: gettext('Saving local copy')
+ };
+ sandbox.getModule('mainBar').setCommandEnabled('save', false);
+ sandbox.getModule('indicator').showMessage(msg[what] + '...');
+ },
+ savingEnded: function(status, what, data) {
+ void(status);
+ var msg = {
+ remote: gettext('Document saved'),
+ local: gettext('Local copy saved')
+ };
+ documentIsDirty = false;
+
+ sandbox.getModule('indicator').clearMessage({message: msg[what]});
+ if(status === 'success' && what === 'remote') {
+ sandbox.getModule('mainBar').setVersion(data.version);
+ documentSummary.render(data);
+ documentSummary.setDraftField('-');
+ sandbox.getModule('mainBar').setCommandEnabled('drop-draft', false);
+ sandbox.getModule('mainBar').setCommandEnabled('save', false);
+ }
+ if(what === 'local') {
+ documentSummary.setDraftField(data.timestamp);
+ sandbox.getModule('mainBar').setCommandEnabled('drop-draft', true);
+ sandbox.getModule('mainBar').setCommandEnabled('save', true);
+ }