##// 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 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
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 <% parsing = false
3 <% parsing = false
7 line_num_l = 0
4 line_num_l = 0
8 line_num_r = 0 %>
5 line_num_r = 0 %>
9 <% @diff.each do |line| %>
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 line_num_l = $2.to_i
21 line_num_l = $2.to_i
13 line_num_r = $5.to_i
22 line_num_r = $5.to_i
14 if parsing %>
15 <tr class="spacing"><td colspan="3">&nbsp;</td></tr>
16 <% end
17 parsing = true
23 parsing = true
18 next
24 next
19 end
25 end
20 next unless parsing
26 next unless parsing
21 %>
27 %>
22
28
23 <tr>
29 <tr>
24
30
25 <% case line[0, 1]
31 <% case line[0, 1]
26 when " " %>
32 when " " %>
27 <th class="line-num"><%= line_num_l %></th>
33 <th class="line-num"><%= line_num_l %></th>
28 <th class="line-num"><%= line_num_r %></th>
34 <th class="line-num"><%= line_num_r %></th>
29 <td class="line-code">
35 <td class="line-code">
30 <% line_num_l = line_num_l + 1
36 <% line_num_l = line_num_l + 1
31 line_num_r = line_num_r + 1
37 line_num_r = line_num_r + 1
32
38
33 when "-" %>
39 when "-" %>
34 <th class="line-num"></th>
40 <th class="line-num"></th>
35 <th class="line-num"><%= line_num_r %></th>
41 <th class="line-num"><%= line_num_r %></th>
36 <td class="line-code" style="background: #fdd;">
42 <td class="line-code" style="background: #fdd;">
37 <% line_num_r = line_num_r + 1
43 <% line_num_r = line_num_r + 1
38
44
39 when "+" %>
45 when "+" %>
40 <th class="line-num"><%= line_num_l %></th>
46 <th class="line-num"><%= line_num_l %></th>
41 <th class="line-num"></th>
47 <th class="line-num"></th>
42 <td class="line-code" style="background: #dfd;">
48 <td class="line-code" style="background: #dfd;">
43 <% line_num_l = line_num_l + 1
49 <% line_num_l = line_num_l + 1
44
50
45 else
51 else
46 next
52 next
47 end %>
53 end %>
48
54
49 <%= h(line[1..-1]).gsub(/\s/, "&nbsp;") %></td></tr>
55 <%= h(line[1..-1]).gsub(/\s/, "&nbsp;") %></td></tr>
50
56
51 <% end %>
57 <% end %>
52 </tbody>
58 </tbody>
53 </table>
59 </table>
54
60
55 <% content_for :header_tags do %>
61 <% content_for :header_tags do %>
56 <%= stylesheet_link_tag "scm" %>
62 <%= stylesheet_link_tag "scm" %>
57 <% end %> No newline at end of file
63 <% end %>
@@ -1,22 +1,28
1
1
2 div.action_M { background: #fd8 }
2 div.action_M { background: #fd8 }
3 div.action_D { background: #f88 }
3 div.action_D { background: #f88 }
4 div.action_A { background: #bfb }
4 div.action_A { background: #bfb }
5
5
6
6
7 tr.spacing {
7 tr.spacing {
8 border: 1px solid #d7d7d7;
8 border: 1px solid #d7d7d7;
9 }
9 }
10
10
11 .line-num {
11 .line-num {
12 border: 1px solid #d7d7d7;
12 border: 1px solid #d7d7d7;
13 font-size: 0.8em;
13 font-size: 0.8em;
14 text-align: right;
14 text-align: right;
15 width: 3em;
15 width: 3em;
16 padding-right: 3px;
16 padding-right: 3px;
17 }
17 }
18
18
19 .line-code {
19 .line-code {
20 font-family: "Courier New", monospace;
20 font-family: "Courier New", monospace;
21 font-size: 1em;
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