From: Aleksander Łukasz Date: Mon, 17 Jun 2013 09:05:51 +0000 (+0200) Subject: Showing previous versions of a publication X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/61637cd5c0cb56fe9cbadd1066ba37d38604249e Showing previous versions of a publication --- diff --git a/modules/data/data.js b/modules/data/data.js index 8c35436..e2cdbb1 100644 --- a/modules/data/data.js +++ b/modules/data/data.js @@ -118,6 +118,9 @@ return function(sandbox) { }, }); } + }, + getDocumentId: function() { + return document_id; } } }; diff --git a/modules/documentHistory/documentHistory.js b/modules/documentHistory/documentHistory.js index 9a01f16..d435617 100644 --- a/modules/documentHistory/documentHistory.js +++ b/modules/documentHistory/documentHistory.js @@ -30,6 +30,10 @@ return function(sandbox) { }); dialog.show(); }); + + dom.find('.btn.display').click(function(e) { + sandbox.publish('displayVersion', {version: historyItems.getSelected()[0]}); + }); var addHistoryItem = function(item, options) { historyItems.add(item); @@ -80,18 +84,18 @@ return function(sandbox) { var len = this._selected.length; if(len === 0) { toggleButton('compare', false); - toggleButton('show2', false); + toggleButton('display', false); toggleButton('restore', false); } if(len === 1) { toggleButton('compare', false); - toggleButton('show2', true); + toggleButton('display', true); toggleButton('restore', true); } if(len === 2) { toggleItemViews(false); toggleButton('compare', true); - toggleButton('show2', false); + toggleButton('display', false); toggleButton('restore', false); } else { toggleItemViews(true); diff --git a/modules/documentHistory/templates/main.html b/modules/documentHistory/templates/main.html index ff4ea79..0e581f6 100644 --- a/modules/documentHistory/templates/main.html +++ b/modules/documentHistory/templates/main.html @@ -3,7 +3,7 @@
- +
diff --git a/modules/rng/rng.js b/modules/rng/rng.js index cd7122c..3b41394 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -285,6 +285,9 @@ return function(sandbox) { }, restoreVersion: function(event) { sandbox.getModule('data').restoreVersion(event); + }, + displayVersion: function(event) { + window.open('/' + gettext('editor') + '/' + sandbox.getModule('data').getDocumentId() + '?version=' + event.version, _.uniqueId()); } }