From 1a05f2f7c9809aa80985c76e8a6d4f662647f150 Mon Sep 17 00:00:00 2001 From: randx Date: Wed, 20 Jun 2012 21:29:55 +0300 Subject: [PATCH] Get rid of deprecated link_to_function --- app/assets/javascripts/application.js | 8 ++++++++ app/assets/javascripts/merge_requests.js | 4 ++++ app/assets/stylesheets/common.scss | 4 ++++ app/views/commits/_text_file.html.haml | 2 +- app/views/merge_requests/_commits.html.haml | 2 +- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0af0b11a..61d6539a 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -53,6 +53,14 @@ $(document).ready(function(){ e.preventDefault(); } }); + + /** + * Commit show suppressed diff + * + */ + $(".supp_diff_link").bind("click", function() { + showDiff(this); + }) }); function focusSearch() { diff --git a/app/assets/javascripts/merge_requests.js b/app/assets/javascripts/merge_requests.js index c075cb4c..8df090cf 100644 --- a/app/assets/javascripts/merge_requests.js +++ b/app/assets/javascripts/merge_requests.js @@ -34,6 +34,10 @@ var MergeRequest = { $(".merge-request-diffs").show(); e.preventDefault(); }); + + $(".mr_show_all_commits").bind("click", function() { + MergeRequest.showAllCommits(); + }) }, showState: diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 82d43d4c..0888b6db 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -602,3 +602,7 @@ li.note { min-height:42px; } +.supp_diff_link, +.mr_show_all_commits { + cursor:pointer; +} diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_file.html.haml index e5173b00..fa3d83ca 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| diff --git a/app/views/merge_requests/_commits.html.haml b/app/views/merge_requests/_commits.html.haml index 441a7f32..3c0c44e0 100644 --- a/app/views/merge_requests/_commits.html.haml +++ b/app/views/merge_requests/_commits.html.haml @@ -9,7 +9,7 @@ %li.bottom 8 of #{@commits.count} commits displayed. %strong - = link_to_function "Click here to show all", "MergeRequest.showAllCommits()" + %a.mr_show_all_commits Click here to show all %ul.all_mr_commits.hide.unstyled - @commits.each do |commit| = render "commits/commit", :commit => commit