X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/7671cda4767353b2a93b05f2332ba6e2f236c468..577bb2b84d936d65bf072ef0a6b898db9d6e77ab:/redakcja/static/js/wiki/view_history.js diff --git a/redakcja/static/js/wiki/view_history.js b/redakcja/static/js/wiki/view_history.js index 4fe20e25..bd6b27b0 100644 --- a/redakcja/static/js/wiki/view_history.js +++ b/redakcja/static/js/wiki/view_history.js @@ -5,6 +5,20 @@ options.callback = function() { var self = this; + if (CurrentDocument.diff) { + rev_from = CurrentDocument.diff[0]; + rev_to = CurrentDocument.diff[1]; + this.doc.fetchDiff({ + from: rev_from, + to: rev_to, + success: function(doc, data){ + var result = $.wiki.newTab(doc, ''+rev_from +' -> ' + rev_to, 'DiffPerspective'); + + $(result.view).html(data); + $.wiki.switchToTab(result.tab); + } + }); + } // first time page is rendered $('#make-diff-button').click(function() { @@ -15,6 +29,10 @@ self.showTagForm(); }); + $('#pubmark-changeset-button').click(function() { + self.showPubmarkForm(); + }); + $('#doc-revert-button').click(function() { self.revertDialog(); }); @@ -140,6 +158,18 @@ $.wiki.showDialog('#add_tag_dialog', {'revision': version}); }; + HistoryPerspective.prototype.showPubmarkForm = function(){ + var selected = $('#changes-list .entry.selected'); + + if (selected.length != 1) { + window.alert("Musisz zaznaczyć dokładnie jedną wersję."); + return; + } + + var version = parseInt($("*[data-stub-value='version']", selected[0]).text()); + $.wiki.showDialog('#pubmark_dialog', {'revision': version}); + }; + HistoryPerspective.prototype.makeDiff = function() { var changelist = $('#changes-list'); var selected = $('.entry.selected', changelist);