##// END OF EJS Templates
patch #8937: Show filename above diff to aid reading multi-file diffs...
Jean-Philippe Lang -
r279:bb3a5bcfd7af
parent child
Show More
@@ -1,57 +1,63
1 1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
2 2
3 <table class="list">
4 <thead><tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr></thead>
5 <tbody>
6 3 <% parsing = false
7 4 line_num_l = 0
8 5 line_num_r = 0 %>
9 6 <% @diff.each do |line| %>
10 7 <%
11 if line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/
8 if line =~ /^Index: (.*)$/
9 if parsing %>
10 </tbody></table>
11 <%
12 end
13 parsing = false %>
14 <table class="list"><thead>
15 <tr><th colspan="3" class="list-filename"><%= l(:label_attachment) %>: <%= $1 %></th></tr>
16 <tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr>
17 </thead><tbody>
18 <%
19 next
20 elsif line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/
12 21 line_num_l = $2.to_i
13 22 line_num_r = $5.to_i
14 if parsing %>
15 <tr class="spacing"><td colspan="3">&nbsp;</td></tr>
16 <% end
17 23 parsing = true
18 24 next
19 25 end
20 26 next unless parsing
21 27 %>
22 28
23 29 <tr>
24 30
25 31 <% case line[0, 1]
26 32 when " " %>
27 33 <th class="line-num"><%= line_num_l %></th>
28 34 <th class="line-num"><%= line_num_r %></th>
29 35 <td class="line-code">
30 36 <% line_num_l = line_num_l + 1
31 37 line_num_r = line_num_r + 1
32 38
33 39 when "-" %>
34 40 <th class="line-num"></th>
35 41 <th class="line-num"><%= line_num_r %></th>
36 42 <td class="line-code" style="background: #fdd;">
37 43 <% line_num_r = line_num_r + 1
38 44
39 45 when "+" %>
40 46 <th class="line-num"><%= line_num_l %></th>
41 47 <th class="line-num"></th>
42 48 <td class="line-code" style="background: #dfd;">
43 49 <% line_num_l = line_num_l + 1
44 50
45 51 else
46 52 next
47 53 end %>
48 54
49 55 <%= h(line[1..-1]).gsub(/\s/, "&nbsp;") %></td></tr>
50 56
51 57 <% end %>
52 58 </tbody>
53 59 </table>
54 60
55 61 <% content_for :header_tags do %>
56 62 <%= stylesheet_link_tag "scm" %>
57 <% end %> No newline at end of file
63 <% end %>
@@ -1,22 +1,28
1 1
2 2 div.action_M { background: #fd8 }
3 3 div.action_D { background: #f88 }
4 4 div.action_A { background: #bfb }
5 5
6 6
7 7 tr.spacing {
8 8 border: 1px solid #d7d7d7;
9 9 }
10 10
11 11 .line-num {
12 12 border: 1px solid #d7d7d7;
13 13 font-size: 0.8em;
14 14 text-align: right;
15 15 width: 3em;
16 16 padding-right: 3px;
17 17 }
18 18
19 19 .line-code {
20 20 font-family: "Courier New", monospace;
21 21 font-size: 1em;
22 } No newline at end of file
22 }
23
24 table.list thead th.list-filename {
25 background-color: #ddc;
26 font-weight: bolder;
27 text-align: left;
28 }
General Comments 0
You need to be logged in to leave comments. Login now