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.
This commit is contained in:
parent
5b1ede6280
commit
ef1598b4af
3 changed files with 8 additions and 6 deletions
|
@ -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({
|
||||
|
|
|
@ -57,3 +57,10 @@ var CommitsList = {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('a.supp_diff_link').live('click', function() {
|
||||
$(link).next('table').show();
|
||||
$(link).remove();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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|
|
||||
|
|
Loading…
Reference in a new issue