[refs #90] change diff anchors to digits

This commit is contained in:
Alexander Machehin 2012-06-08 01:20:06 +06:00
parent 0b9c0fdd07
commit 62128d2c72
4 changed files with 7 additions and 5 deletions

View File

@ -3,9 +3,10 @@ module CommitHelper
def render_commit_stats(stats)
res = ["<table class='commit_stats'>"]
ind=0
stats.files.each do |filename, adds, deletes, total|
res << "<tr>"
res << "<td><a href='##{h(filename)}'>#{h(filename)}</a></td>"
res << "<td><a href='#diff-#{ind}'>#{h(filename)}</a></td>"
res << "<td class='diffstat'>"
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 << "</td>"
ind +=1
end
res << "</table>"

View File

@ -17,9 +17,9 @@ module DiffHelper
def render_diff_stats(stats)
res = ["<table class='commit_stats'>"]
stats.each do |stat|
stats.each_with_index do |stat, ind|
res << "<tr>"
res << "<td><a href='##{h(stat.filename)}'>#{h(stat.filename)}</a></td>"
res << "<td><a href='#diff-#{ind}'>#{h(stat.filename)}</a></td>"
res << "<td class='diffstat'>"
res << I18n.t("layout.projects.inline_changes_count", :count => stat.additions + stat.deletions).strip +
" (" +

View File

@ -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?

View File

@ -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?