patch #8937: Show filename above diff to aid reading multi-file diffs

git-svn-id: http://redmine.rubyforge.org/svn/trunk@282 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-02-28 19:26:53 +00:00
parent 35678a1c09
commit bb3a5bcfd7
2 changed files with 21 additions and 9 deletions

View File

@ -1,19 +1,25 @@
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
<table class="list">
<thead><tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr></thead>
<tbody>
<% parsing = false
line_num_l = 0
line_num_r = 0 %>
<% @diff.each do |line| %>
<%
if line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/
if line =~ /^Index: (.*)$/
if parsing %>
</tbody></table>
<%
end
parsing = false %>
<table class="list"><thead>
<tr><th colspan="3" class="list-filename"><%= l(:label_attachment) %>: <%= $1 %></th></tr>
<tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr>
</thead><tbody>
<%
next
elsif line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/
line_num_l = $2.to_i
line_num_r = $5.to_i
if parsing %>
<tr class="spacing"><td colspan="3">&nbsp;</td></tr>
<% end
parsing = true
next
end
@ -54,4 +60,4 @@ line_num_r = 0 %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag "scm" %>
<% end %>
<% end %>

View File

@ -19,4 +19,10 @@ tr.spacing {
.line-code {
font-family: "Courier New", monospace;
font-size: 1em;
}
}
table.list thead th.list-filename {
background-color: #ddc;
font-weight: bolder;
text-align: left;
}