| 1 |
1 |
<% diff = Redmine::UnifiedDiff.new(diff, :type => diff_type, :max_lines => Setting.diff_max_lines_displayed.to_i) -%>
|
|
2 |
|
| 2 |
3 |
<% diff.each do |table_file| -%>
|
| 3 |
4 |
<div class="autoscroll">
|
| 4 |
|
<% if diff_type == 'sbs' -%>
|
|
5 |
<% if diff.diff_type == 'sbs' -%>
|
| 5 |
6 |
<table class="filecontent">
|
| 6 |
7 |
<thead>
|
| 7 |
8 |
<tr><th colspan="4" class="filename"><%=to_utf8 table_file.file_name %></th></tr>
|
| 8 |
9 |
</thead>
|
| 9 |
10 |
<tbody>
|
| 10 |
|
<% prev_line_left, prev_line_right = nil, nil -%>
|
| 11 |
|
<% table_file.keys.sort.each do |key| -%>
|
| 12 |
|
<% if prev_line_left && prev_line_right && (table_file[key].nb_line_left != prev_line_left+1) && (table_file[key].nb_line_right != prev_line_right+1) -%>
|
|
11 |
<% table_file.each_line do |spacing, line| -%>
|
|
12 |
<% if spacing -%>
|
| 13 |
13 |
<tr class="spacing">
|
| 14 |
|
<th class="line-num">...</th><td></td><th class="line-num">...</th><td></td>
|
|
14 |
<th class="line-num">...</th><td></td><th class="line-num">...</th><td></td>
|
|
15 |
</tr>
|
| 15 |
16 |
<% end -%>
|
| 16 |
17 |
<tr>
|
| 17 |
|
<th class="line-num"><%= table_file[key].nb_line_left %></th>
|
| 18 |
|
<td class="line-code <%= table_file[key].type_diff_left %>">
|
| 19 |
|
<pre><%=to_utf8 table_file[key].line_left %></pre>
|
|
18 |
<th class="line-num"><%= line.nb_line_left %></th>
|
|
19 |
<td class="line-code <%= line.type_diff_left %>">
|
|
20 |
<pre><%=to_utf8 line.html_line_left %></pre>
|
| 20 |
21 |
</td>
|
| 21 |
|
<th class="line-num"><%= table_file[key].nb_line_right %></th>
|
| 22 |
|
<td class="line-code <%= table_file[key].type_diff_right %>">
|
| 23 |
|
<pre><%=to_utf8 table_file[key].line_right %></pre>
|
|
22 |
<th class="line-num"><%= line.nb_line_right %></th>
|
|
23 |
<td class="line-code <%= line.type_diff_right %>">
|
|
24 |
<pre><%=to_utf8 line.html_line_right %></pre>
|
| 24 |
25 |
</td>
|
| 25 |
26 |
</tr>
|
| 26 |
|
<% prev_line_left, prev_line_right = table_file[key].nb_line_left.to_i, table_file[key].nb_line_right.to_i -%>
|
| 27 |
27 |
<% end -%>
|
| 28 |
28 |
</tbody>
|
| 29 |
29 |
</table>
|
| 30 |
30 |
|
| 31 |
31 |
<% else -%>
|
| 32 |
|
<table class="filecontent syntaxhl">
|
|
32 |
<table class="filecontent">
|
| 33 |
33 |
<thead>
|
| 34 |
34 |
<tr><th colspan="3" class="filename"><%=to_utf8 table_file.file_name %></th></tr>
|
| 35 |
35 |
</thead>
|
| 36 |
36 |
<tbody>
|
| 37 |
|
<% prev_line_left, prev_line_right = nil, nil -%>
|
| 38 |
|
<% table_file.keys.sort.each do |key, line| %>
|
| 39 |
|
<% if prev_line_left && prev_line_right && (table_file[key].nb_line_left != prev_line_left+1) && (table_file[key].nb_line_right != prev_line_right+1) -%>
|
|
37 |
<% table_file.each_line do |spacing, line| %>
|
|
38 |
<% if spacing -%>
|
| 40 |
39 |
<tr class="spacing">
|
| 41 |
|
<th class="line-num">...</th><th class="line-num">...</th><td></td>
|
|
40 |
<th class="line-num">...</th><th class="line-num">...</th><td></td>
|
| 42 |
41 |
</tr>
|
| 43 |
42 |
<% end -%>
|
| 44 |
43 |
<tr>
|
| 45 |
|
<th class="line-num"><%= table_file[key].nb_line_left %></th>
|
| 46 |
|
<th class="line-num"><%= table_file[key].nb_line_right %></th>
|
| 47 |
|
<% if table_file[key].line_left.empty? -%>
|
| 48 |
|
<td class="line-code <%= table_file[key].type_diff_right %>">
|
| 49 |
|
<pre><%=to_utf8 table_file[key].line_right %></pre>
|
|
44 |
<th class="line-num"><%= line.nb_line_left %></th>
|
|
45 |
<th class="line-num"><%= line.nb_line_right %></th>
|
|
46 |
<td class="line-code <%= line.type_diff %>">
|
|
47 |
<pre><%=to_utf8 line.html_line %></pre>
|
| 50 |
48 |
</td>
|
| 51 |
|
<% else -%>
|
| 52 |
|
<td class="line-code <%= table_file[key].type_diff_left %>">
|
| 53 |
|
<pre><%=to_utf8 table_file[key].line_left %></pre>
|
| 54 |
|
</td>
|
| 55 |
|
<% end -%>
|
| 56 |
49 |
</tr>
|
| 57 |
|
<% prev_line_left = table_file[key].nb_line_left.to_i if table_file[key].nb_line_left.to_i > 0 -%>
|
| 58 |
|
<% prev_line_right = table_file[key].nb_line_right.to_i if table_file[key].nb_line_right.to_i > 0 -%>
|
| 59 |
50 |
<% end -%>
|
| 60 |
51 |
</tbody>
|
| 61 |
52 |
</table>
|
| 62 |
53 |
<% end -%>
|
| 63 |
|
|
| 64 |
54 |
</div>
|
| 65 |
55 |
<% end -%>
|
| 66 |
56 |
|