Commit 5b1ede628065ecfdf95552322328b5bb7613753a

Authored by Robb Kidd
1 parent 7484bcff

Handle MR "show all commits" 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.
app/assets/javascripts/merge_requests.js
... ... @@ -58,15 +58,16 @@ var MergeRequest = {
58 58 dataType: "script"});
59 59 },
60 60  
61   - showAllCommits:
62   - function() {
63   - $(".first_mr_commits").remove();
64   - $(".all_mr_commits").removeClass("hide");
65   - },
66   -
67 61 already_cannot_be_merged:
68 62 function(){
69 63 $(".automerge_widget").hide();
70 64 $(".automerge_widget.already_cannot_be_merged").show();
71 65 }
72 66 }
  67 +
  68 +$(function () {
  69 + $('.first_mr_commits a.show_all').live('click', function() {
  70 + $(".first_mr_commits").remove();
  71 + $(".all_mr_commits").removeClass("hide");
  72 + });
  73 +});
... ...
app/views/merge_requests/_commits.html.haml
... ... @@ -9,7 +9,7 @@
9 9 %li.bottom
10 10 8 of #{@commits.count} commits displayed.
11 11 %strong
12   - = link_to_function "Click here to show all", "MergeRequest.showAllCommits()"
  12 + %a.show_all Click here to show all
13 13 %ul.all_mr_commits.hide.unstyled
14 14 - @commits.each do |commit|
15 15 = render "commits/commit", :commit => commit
... ...