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