From 01e3f7b4f74f7012c3407ce8d67885de8be277a5 Mon Sep 17 00:00:00 2001 From: Eston Bond Date: Mon, 15 Nov 2010 13:07:57 -0800 Subject: [PATCH] Hook up compare revisions selector --- .../frontend/public/javascript/gollum.js | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/lib/gollum/frontend/public/javascript/gollum.js b/lib/gollum/frontend/public/javascript/gollum.js index 9e0305c7..e88fb0b0 100644 --- a/lib/gollum/frontend/public/javascript/gollum.js +++ b/lib/gollum/frontend/public/javascript/gollum.js @@ -29,26 +29,34 @@ $(document).ready(function() { $('#wiki-history td.revert-action a').mouseenter(highlightOn); $('#wiki-history td.revert-action a').mouseleave(highlightOff); + + if ($('td.revert-action a').length) { + $('td.revert-action a').click(function(e) { + e.preventDefault(); + + var commitSha = $(this).attr('rel'); + var truncatedSha = commitSha.toString().substr(0, 7); + // revert action + $.GollumDialog.init({ + title: 'Revert to ' + truncatedSha + '?', + body: 'Are you sure you wish to revert to commit ' + + truncatedSha + '' + + ' ? This will overwrite any previous changes.', + OK: function() { + // TODO add async endpoint to revert here + } + }); + }); + } + + if ($('.history a.action-compare-revision').length) { + $('.history a.action-compare-revision').click(function() { + $("#version-form").submit(); + }); + } } - if ($('td.revert-action a').length) { - $('td.revert-action a').click(function(e) { - e.preventDefault(); - - var commitSha = $(this).attr('rel'); - var truncatedSha = commitSha.toString().substr(0, 7); - // revert action - $.GollumDialog.init({ - title: 'Revert to ' + truncatedSha + '?', - body: 'Are you sure you wish to revert to commit ' + - truncatedSha + '' + - ' ? This will overwrite any previous changes.', - OK: function() { - // TODO add async endpoint to revert here - } - }); - }); - } + if ($('#searchbar a#search-submit').length) { $.GollumPlaceholder.add($('#searchbar #search-query'));