From 6507c1085e02d9e59020c38ceff3308374dd1df0 Mon Sep 17 00:00:00 2001 From: Zevs Date: Wed, 20 Jun 2012 21:01:27 +0300 Subject: [PATCH] Revert "Handle Commit "show suppressed diff" link with a doc-ready event handler." This reverts commit ef1598b4afa94b21db7f38755182a701d03ae44a. --- app/assets/javascripts/application.js | 5 +++++ app/assets/javascripts/commits.js | 7 ------- app/views/commits/_text_file.html.haml | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index bc91c973..0af0b11a 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -75,6 +75,11 @@ 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 5afac8c3..b31fe485 100644 --- a/app/assets/javascripts/commits.js +++ b/app/assets/javascripts/commits.js @@ -57,10 +57,3 @@ 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 fa3d83ca..e5173b00 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 - %a.supp_diff_link Diff suppressed. Click to show + = link_to_function "Diff suppressed. Click to show", "showDiff(this)", :class => "supp_diff_link" %table{:class => "#{'hide' if too_big}"} - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old|