3 function fetchDiff(success, failed){
4 var changelist = $('#changes-list');
5 var rev_a = $("input[name='rev_from']:checked", changelist);
6 var rev_b = $("input[name='rev_to']:checked", changelist);
8 if (rev_a.length != 1 || rev_b.length != 1) {
9 window.alert("Musisz zaznaczyć dwie wersje do porównania.");
13 if (rev_a.val() == rev_b.val()) {
14 window.alert("Musisz zaznaczyć dwie różne wersje do porównania.");
19 message: 'Wczytywanie porównania...'
23 url: document.location.href + '/diff/' + rev_a.val() + '/' + rev_b.val(),
29 success: function(data){
30 var diffview = $('#diff-view');
39 function HistoryPerspective(doc, callback) {
40 this.perspective_id = 'HistoryPerspective';
43 // first time page is rendered
44 $('#make-diff-button').click(fetchDiff);
48 HistoryPerspective.prototype = new $.wiki.Perspective();
50 HistoryPerspective.prototype.freezeState = function(){
54 HistoryPerspective.prototype.onEnter = function(success, failure)
56 $.wiki.Perspective.prototype.onEnter.call(this);
59 message: 'Odświeżanie historii...'
62 function _finalize(s) {
65 if(s) { if(success) success(); }
66 else { if(failure) failure(); }
69 function _failure(doc, message) {
70 $('#history-view .message-box').html('Nie udało się odświeżyć historii:' + message).show();
74 function _success(doc, data) {
75 $('#history-view .message-box').hide();
76 var changes_list = $('#changes-list');
77 var $stub = $('#history-view .row-stub');
78 changes_list.html('');
80 $.each(data, function(){
81 $.wiki.renderStub(changes_list, $stub, this);
87 return this.doc.fetchHistory({success: _success, failure: _failure});
90 $.wiki.HistoryPerspective = HistoryPerspective;