From 62128d2c72fa670b3ca336ce88ab64485c9e80cd Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Fri, 8 Jun 2012 01:20:06 +0600 Subject: [PATCH] [refs #90] change diff anchors to digits --- app/helpers/commit_helper.rb | 4 +++- app/helpers/diff_helper.rb | 4 ++-- app/views/projects/git/commits/_commit_diff.html.haml | 2 +- app/views/projects/pull_requests/_pull_diff.html.haml | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/helpers/commit_helper.rb b/app/helpers/commit_helper.rb index d6019a772..bff429b9f 100644 --- a/app/helpers/commit_helper.rb +++ b/app/helpers/commit_helper.rb @@ -3,9 +3,10 @@ module CommitHelper def render_commit_stats(stats) res = [""] + ind=0 stats.files.each do |filename, adds, deletes, total| res << "" - res << "" + res << "" res << "" + ind +=1 end res << "
#{h(filename)}#{h(filename)}" res << I18n.t("layout.projects.inline_changes_count", :count => total).strip + " (" + @@ -14,6 +15,7 @@ module CommitHelper I18n.t("layout.projects.inline_deletions_count", :count => deletes).strip + ")" res << "
" diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 69bc9515d..677d3de45 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -17,9 +17,9 @@ module DiffHelper def render_diff_stats(stats) res = [""] - stats.each do |stat| + stats.each_with_index do |stat, ind| res << "" - res << "" + res << "" res << "
#{h(stat.filename)}#{h(stat.filename)}" res << I18n.t("layout.projects.inline_changes_count", :count => stat.additions + stat.deletions).strip + " (" + diff --git a/app/views/projects/git/commits/_commit_diff.html.haml b/app/views/projects/git/commits/_commit_diff.html.haml index 423436a92..3d8fc34f6 100644 --- a/app/views/projects/git/commits/_commit_diff.html.haml +++ b/app/views/projects/git/commits/_commit_diff.html.haml @@ -1,6 +1,6 @@ - commit_id = commit_diff.deleted_file ? @commit.parents.first.id : @commit.id .file - %a{:name => h(commit_diff.a_path)} + %a{:name => "diff-#{commit_diff_counter}"} .top .l= h(commit_diff.a_path.reverse.truncate(120, :separator => '/').reverse) - if commit_diff.b_path.present? diff --git a/app/views/projects/pull_requests/_pull_diff.html.haml b/app/views/projects/pull_requests/_pull_diff.html.haml index b1f06c556..ff67b0781 100644 --- a/app/views/projects/pull_requests/_pull_diff.html.haml +++ b/app/views/projects/pull_requests/_pull_diff.html.haml @@ -1,6 +1,6 @@ - commit_id = pull_diff.deleted_file ? @base_commit.id : @head_commit.id .file - %a{:name => h(pull_diff.a_path)} + %a{:name => "diff-#{pull_diff_counter}"} .top .l= h(pull_diff.renamed_file ? "#{pull_diff.a_path.reverse.truncate(60, :separator => '/').reverse} -> #{pull_diff.b_path.reverse.truncate(60, :separator => '/').reverse}" : pull_diff.a_path.reverse.truncate(120, :separator => '/').reverse) - if pull_diff.b_path.present?