X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e8c45077de2d4ada496850fd77fa5035f07f8a4d..bb42027c8fd9ed17234381d3c366c387a20592f0:/modules/documentHistory/documentHistory.js diff --git a/modules/documentHistory/documentHistory.js b/modules/documentHistory/documentHistory.js index 9a01f16..2647ee3 100644 --- a/modules/documentHistory/documentHistory.js +++ b/modules/documentHistory/documentHistory.js @@ -13,7 +13,7 @@ return function(sandbox) { var dom = $(_.template(mainTemplateSrc)()); var domNodes = { itemList: dom.find('.rng-module-documentHistory-itemsList'), - } + }; var itemViews = []; @@ -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); @@ -39,18 +43,18 @@ return function(sandbox) { if(options.animate) { view.dom.hide().slideDown(); } - } + }; var toggleItemViews = function(toggle) { itemViews.forEach(function(view) { if(!historyItems.isSelected(view.item)) view.toggle(toggle); }); - } + }; var toggleButton = function(btn, toggle) { dom.find('button.'+btn).toggleClass('disabled', !toggle); - } + }; var historyItems = { _itemsById: {}, @@ -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); @@ -136,7 +140,7 @@ return function(sandbox) { getView: function() { return dom; } - } -} + }; +}; }); \ No newline at end of file