diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0af0b11..bc91c97 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -75,11 +75,6 @@ function slugify(text) { return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase(); } -function showDiff(link) { - $(link).next('table').show(); - $(link).remove(); -} - (function($){ var _chosen = $.fn.chosen; $.fn.extend({ diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js index b31fe48..5afac8c 100644 --- a/app/assets/javascripts/commits.js +++ b/app/assets/javascripts/commits.js @@ -57,3 +57,10 @@ var CommitsList = { }); } } + +$(function () { + $('a.supp_diff_link').live('click', function() { + $(link).next('table').show(); + $(link).remove(); + }); +}); diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_file.html.haml index e5173b0..fa3d83c 100644 --- a/app/views/commits/_text_file.html.haml +++ b/app/views/commits/_text_file.html.haml @@ -1,6 +1,6 @@ - too_big = max_lines = diff.diff.lines.count > 1000 - if too_big - = link_to_function "Diff suppressed. Click to show", "showDiff(this)", :class => "supp_diff_link" + %a.supp_diff_link Diff suppressed. Click to show %table{:class => "#{'hide' if too_big}"} - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| -- libgit2 0.21.2