From: Aleksander Łukasz Date: Mon, 17 Jun 2013 12:38:40 +0000 (+0200) Subject: Displaying current version of the publication X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/5e64f92aabe77137fde16fa8aab604fe1fce5f62?ds=inline;hp=73a6ba2accc1ac01c6a525a477f7c99c6ee4f3e6 Displaying current version of the publication --- diff --git a/modules/data/data.js b/modules/data/data.js index e2cdbb1..108f2ea 100644 --- a/modules/data/data.js +++ b/modules/data/data.js @@ -6,6 +6,7 @@ return function(sandbox) { var doc = sandbox.getBootstrappedData().document; var document_id = sandbox.getBootstrappedData().document_id; + var document_version = sandbox.getBootstrappedData().version var history = sandbox.getBootstrappedData().history; @@ -113,14 +114,18 @@ return function(sandbox) { data: JSON.stringify(options), success: function(data) { doc = data.document; + document_version = data.version; reloadHistory(); - sandbox.publish('documentReverted', {document: data.document, version: data.version}); + sandbox.publish('documentReverted', data); }, }); } }, getDocumentId: function() { return document_id; + }, + getDocumentVersion: function() { + return document_version; } } }; diff --git a/modules/mainBar/mainBar.js b/modules/mainBar/mainBar.js index 75fd599..084f675 100644 --- a/modules/mainBar/mainBar.js +++ b/modules/mainBar/mainBar.js @@ -18,6 +18,9 @@ return function(sandbox) { getView: function() {return view;}, setCommandEnabled: function(cmd, enabled) { view.find('[data-cmd='+cmd+']').toggleClass('disabled', !enabled); + }, + setVersion: function(version) { + view.find('.version').text(version); } } diff --git a/modules/mainBar/mainBar.less b/modules/mainBar/mainBar.less index 12bdd35..327fa56 100644 --- a/modules/mainBar/mainBar.less +++ b/modules/mainBar/mainBar.less @@ -3,8 +3,16 @@ }*/ .rng-module-mainBar { + + font-size: 10px; + li { display: inline; + border-width: 0 1px 0 0; + border-color: #ddd; + border-style: solid; + margin: 0 5px 0 0; + padding: 0 5px 0 0; } ul { diff --git a/modules/mainBar/template.html b/modules/mainBar/template.html index 0696053..f8d4641 100644 --- a/modules/mainBar/template.html +++ b/modules/mainBar/template.html @@ -1,5 +1,6 @@
diff --git a/modules/rng/rng.js b/modules/rng/rng.js index 3b41394..276b0db 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -158,12 +158,14 @@ return function(sandbox) { documentReverted: function(event) { commands.resetDocument(event.document, 'revert'); sandbox.getModule('mainBar').setCommandEnabled('save', true); - sandbox.getModule('indicator').clearMessage({message:'Wersja ' + event.version + ' przywrócona'}); + sandbox.getModule('indicator').clearMessage({message:'Wersja ' + event.reverted_version + ' przywrócona'}); + sandbox.getModule('mainBar').setVersion(event.current_version); } } eventHandlers.mainBar = { ready: function() { + sandbox.getModule('mainBar').setVersion(sandbox.getModule('data').getDocumentVersion()); views.mainLayout.setView('topPanel', sandbox.getModule('mainBar').getView()); }, 'cmd.save': function() {