Commit 65c35394ebb5de7619b71949a883b1071bf72b98

Authored by Valeriy Sizov
2 parents 4ac0160a ef1598b4

Merge pull request #951 from robbkidd/remove_link_to_function

Replace calls to deprecated link_to_function with doc-ready functions.
app/assets/javascripts/application.js
... ... @@ -75,11 +75,6 @@ function slugify(text) {
75 75 return text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase();
76 76 }
77 77  
78   -function showDiff(link) {
79   - $(link).next('table').show();
80   - $(link).remove();
81   -}
82   -
83 78 (function($){
84 79 var _chosen = $.fn.chosen;
85 80 $.fn.extend({
... ...
app/assets/javascripts/commits.js
... ... @@ -57,3 +57,10 @@ var CommitsList = {
57 57 });
58 58 }
59 59 }
  60 +
  61 +$(function () {
  62 + $('a.supp_diff_link').live('click', function() {
  63 + $(link).next('table').show();
  64 + $(link).remove();
  65 + });
  66 +});
... ...
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/commits/_text_file.html.haml
1 1 - too_big = max_lines = diff.diff.lines.count > 1000
2 2 - if too_big
3   - = link_to_function "Diff suppressed. Click to show", "showDiff(this)", :class => "supp_diff_link"
  3 + %a.supp_diff_link Diff suppressed. Click to show
4 4  
5 5 %table{:class => "#{'hide' if too_big}"}
6 6 - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old|
... ...
app/views/merge_requests/_commits.html.haml
1   -- unless @commits.empty?
  1 +- if @commits.present?
2 2 .ui-box
3 3 %h5 Commits (#{@commits.count})
4 4 .merge-request-commits
... ... @@ -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
... ...