Commit ef1598b4afa94b21db7f38755182a701d03ae44a
1 parent
5b1ede62
Exists in
master
and in
4 other branches
Handle Commit "show suppressed diff" link with a doc-ready event handler.
Replaces link_to_function use which was deprecated in Rails v3.2.4. https://github.com/rails/rails/commit/9dc57fe9c Still absent is a graceful degrade for no-JS.
Showing
3 changed files
with
8 additions
and
6 deletions
Show diff stats
app/assets/javascripts/application.js
@@ -75,11 +75,6 @@ function slugify(text) { | @@ -75,11 +75,6 @@ function slugify(text) { | ||
75 | return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase(); | 75 | return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase(); |
76 | } | 76 | } |
77 | 77 | ||
78 | -function showDiff(link) { | ||
79 | - $(link).next('table').show(); | ||
80 | - $(link).remove(); | ||
81 | -} | ||
82 | - | ||
83 | (function($){ | 78 | (function($){ |
84 | var _chosen = $.fn.chosen; | 79 | var _chosen = $.fn.chosen; |
85 | $.fn.extend({ | 80 | $.fn.extend({ |
app/assets/javascripts/commits.js
app/views/commits/_text_file.html.haml
1 | - too_big = max_lines = diff.diff.lines.count > 1000 | 1 | - too_big = max_lines = diff.diff.lines.count > 1000 |
2 | - if too_big | 2 | - if too_big |
3 | - = link_to_function "Diff suppressed. Click to show", "showDiff(this)", :class => "supp_diff_link" | 3 | + %a.supp_diff_link Diff suppressed. Click to show |
4 | 4 | ||
5 | %table{:class => "#{'hide' if too_big}"} | 5 | %table{:class => "#{'hide' if too_big}"} |
6 | - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| | 6 | - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| |