diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0af0b11a931..bc91c9730ec 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -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({ diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js index b31fe485896..5afac8c32c3 100644 --- a/app/assets/javascripts/commits.js +++ b/app/assets/javascripts/commits.js @@ -57,3 +57,10 @@ var CommitsList = { }); } } + +$(function () { + $('a.supp_diff_link').live('click', function() { + $(link).next('table').show(); + $(link).remove(); + }); +}); diff --git a/app/assets/javascripts/merge_requests.js b/app/assets/javascripts/merge_requests.js index c075cb4c0a3..9a18f335559 100644 --- a/app/assets/javascripts/merge_requests.js +++ b/app/assets/javascripts/merge_requests.js @@ -58,15 +58,16 @@ var MergeRequest = { dataType: "script"}); }, - showAllCommits: - function() { - $(".first_mr_commits").remove(); - $(".all_mr_commits").removeClass("hide"); - }, - already_cannot_be_merged: function(){ $(".automerge_widget").hide(); $(".automerge_widget.already_cannot_be_merged").show(); } } + +$(function () { + $('.first_mr_commits a.show_all').live('click', function() { + $(".first_mr_commits").remove(); + $(".all_mr_commits").removeClass("hide"); + }); +}); 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..ad3cba2b822 100644 --- a/app/views/merge_requests/_commits.html.haml +++ b/app/views/merge_requests/_commits.html.haml @@ -1,4 +1,4 @@ -- unless @commits.empty? +- if @commits.present? .ui-box %h5 Commits (#{@commits.count}) .merge-request-commits @@ -9,7 +9,7 @@ %li.bottom 8 of #{@commits.count} commits displayed. %strong - = link_to_function "Click here to show all", "MergeRequest.showAllCommits()" + %a.show_all Click here to show all %ul.all_mr_commits.hide.unstyled - @commits.each do |commit| = render "commits/commit", :commit => commit