Commit 5b1ede628065ecfdf95552322328b5bb7613753a
1 parent
7484bcff
Exists in
master
and in
4 other branches
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.
Showing
2 changed files
with
8 additions
and
7 deletions
Show diff stats
app/assets/javascripts/merge_requests.js
| @@ -58,15 +58,16 @@ var MergeRequest = { | @@ -58,15 +58,16 @@ var MergeRequest = { | ||
| 58 | dataType: "script"}); | 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 | already_cannot_be_merged: | 61 | already_cannot_be_merged: |
| 68 | function(){ | 62 | function(){ |
| 69 | $(".automerge_widget").hide(); | 63 | $(".automerge_widget").hide(); |
| 70 | $(".automerge_widget.already_cannot_be_merged").show(); | 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,7 +9,7 @@ | ||
| 9 | %li.bottom | 9 | %li.bottom |
| 10 | 8 of #{@commits.count} commits displayed. | 10 | 8 of #{@commits.count} commits displayed. |
| 11 | %strong | 11 | %strong |
| 12 | - = link_to_function "Click here to show all", "MergeRequest.showAllCommits()" | 12 | + %a.show_all Click here to show all |
| 13 | %ul.all_mr_commits.hide.unstyled | 13 | %ul.all_mr_commits.hide.unstyled |
| 14 | - @commits.each do |commit| | 14 | - @commits.each do |commit| |
| 15 | = render "commits/commit", :commit => commit | 15 | = render "commits/commit", :commit => commit |