From 61637cd5c0cb56fe9cbadd1066ba37d38604249e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 17 Jun 2013 11:05:51 +0200 Subject: [PATCH 1/1] Showing previous versions of a publication --- modules/data/data.js | 3 +++ modules/documentHistory/documentHistory.js | 10 +++++++--- modules/documentHistory/templates/main.html | 2 +- modules/rng/rng.js | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) 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()); } } -- 2.20.1