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