From 1a05f2f7c9809aa80985c76e8a6d4f662647f150 Mon Sep 17 00:00:00 2001 From: randx Date: Wed, 20 Jun 2012 21:29:55 +0300 Subject: [PATCH 1/2] 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 0af0b11a931..61d6539a559 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 c075cb4c0a3..8df090cfa37 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 82d43d4c83e..0888b6db1f5 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 e5173b00ed7..fa3d83ca85d 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 441a7f32ef4..3c0c44e069a 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 From d5b41831d141de75b8566a93b490c8b160c73f32 Mon Sep 17 00:00:00 2001 From: randx Date: Wed, 20 Jun 2012 23:08:10 +0300 Subject: [PATCH 2/2] missed ; --- app/assets/javascripts/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 61d6539a559..8b8c4291f5d 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -60,7 +60,7 @@ $(document).ready(function(){ */ $(".supp_diff_link").bind("click", function() { showDiff(this); - }) + }); }); function focusSearch() {