Adding "replace all" functionality to replace find & replace tool
[redakcja.git] / redakcja / static / js / wiki / view_history.js
index 4fe20e2..85adca0 100644 (file)
@@ -5,14 +5,28 @@
 
                options.callback = function() {
                        var self = this;
 
                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() {
                                self.makeDiff();
                        });
 
 
                        // first time page is rendered
                $('#make-diff-button').click(function() {
                                self.makeDiff();
                        });
 
-                       $('#tag-changeset-button').click(function() {
-                               self.showTagForm();
+                       $('#pubmark-changeset-button').click(function() {
+                               self.showPubmarkForm();
                        });
 
                $('#doc-revert-button').click(function() {
                        });
 
                $('#doc-revert-button').click(function() {
         });
     };
 
         });
     };
 
-       HistoryPerspective.prototype.showTagForm = function(){
+       HistoryPerspective.prototype.showPubmarkForm = function(){
                var selected = $('#changes-list .entry.selected');
 
                if (selected.length != 1) {
                var selected = $('#changes-list .entry.selected');
 
                if (selected.length != 1) {
         }
 
                var version = parseInt($("*[data-stub-value='version']", selected[0]).text());
         }
 
                var version = parseInt($("*[data-stub-value='version']", selected[0]).text());
-               $.wiki.showDialog('#add_tag_dialog', {'revision': version});
+               $.wiki.showDialog('#pubmark_dialog', {'revision': version});
        };
 
        HistoryPerspective.prototype.makeDiff = function() {
        };
 
        HistoryPerspective.prototype.makeDiff = function() {