##// END OF EJS Templates
fixed: no diff display with one line files [#8883]...
Jean-Philippe Lang -
r273:77938cc11e20
parent child
Show More
@@ -1,57 +1,57
1 1 <h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
2 2
3 3 <table class="list">
4 4 <thead><tr><th>@<%= @rev %></th><th>@<%= @rev_to %></th><th></th></tr></thead>
5 5 <tbody>
6 6 <% parsing = false
7 7 line_num_l = 0
8 8 line_num_r = 0 %>
9 9 <% @diff.each do |line| %>
10 10 <%
11 if line =~ /^@@ (\+|\-)(\d+),\d+ (\+|\-)(\d+),\d+ @@/
11 if line =~ /^@@ (\+|\-)(\d+)(,\d+)? (\+|\-)(\d+)(,\d+)? @@/
12 12 line_num_l = $2.to_i
13 line_num_r = $4.to_i
13 line_num_r = $5.to_i
14 14 if parsing %>
15 15 <tr class="spacing"><td colspan="3">&nbsp;</td></tr>
16 16 <% end
17 17 parsing = true
18 18 next
19 19 end
20 20 next unless parsing
21 21 %>
22 22
23 23 <tr>
24 24
25 25 <% case line[0, 1]
26 26 when " " %>
27 27 <th class="line-num"><%= line_num_l %></th>
28 28 <th class="line-num"><%= line_num_r %></th>
29 29 <td class="line-code">
30 30 <% line_num_l = line_num_l + 1
31 31 line_num_r = line_num_r + 1
32 32
33 33 when "-" %>
34 34 <th class="line-num"></th>
35 35 <th class="line-num"><%= line_num_r %></th>
36 36 <td class="line-code" style="background: #fdd;">
37 37 <% line_num_r = line_num_r + 1
38 38
39 39 when "+" %>
40 40 <th class="line-num"><%= line_num_l %></th>
41 41 <th class="line-num"></th>
42 42 <td class="line-code" style="background: #dfd;">
43 43 <% line_num_l = line_num_l + 1
44 44
45 45 else
46 46 next
47 47 end %>
48 48
49 49 <%= h(line[1..-1]).gsub(/\s/, "&nbsp;") %></td></tr>
50 50
51 51 <% end %>
52 52 </tbody>
53 53 </table>
54 54
55 55 <% content_for :header_tags do %>
56 56 <%= stylesheet_link_tag "scm" %>
57 57 <% end %> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now