@@ -0,0 +1,74 | |||
|
1 | <% Redmine::UnifiedDiff.new(diff, diff_type).each do |table_file| -%> | |
|
2 | <div class="autoscroll"> | |
|
3 | <% if diff_type == 'sbs' -%> | |
|
4 | <table class="filecontent CodeRay"> | |
|
5 | <thead> | |
|
6 | <tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr> | |
|
7 | <% unless @rev.nil? -%> | |
|
8 | <tr> | |
|
9 | <th colspan="2">@<%= format_revision @rev %></th> | |
|
10 | <th colspan="2">@<%= format_revision @rev_to %></th> | |
|
11 | </tr> | |
|
12 | <% end -%> | |
|
13 | </thead> | |
|
14 | <tbody> | |
|
15 | <% prev_line_left, prev_line_right = nil, nil -%> | |
|
16 | <% table_file.keys.sort.each do |key| -%> | |
|
17 | <% 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) -%> | |
|
18 | <tr class="spacing"><td colspan="4"></td></tr> | |
|
19 | <% end -%> | |
|
20 | <tr> | |
|
21 | <th class="line-num"><%= table_file[key].nb_line_left %></th> | |
|
22 | <td class="line-code <%= table_file[key].type_diff_left %>"> | |
|
23 | <pre><%=to_utf8 table_file[key].line_left %></pre> | |
|
24 | </td> | |
|
25 | <th class="line-num"><%= table_file[key].nb_line_right %></th> | |
|
26 | <td class="line-code <%= table_file[key].type_diff_right %>"> | |
|
27 | <pre><%=to_utf8 table_file[key].line_right %></pre> | |
|
28 | </td> | |
|
29 | </tr> | |
|
30 | <% prev_line_left, prev_line_right = table_file[key].nb_line_left.to_i, table_file[key].nb_line_right.to_i -%> | |
|
31 | <% end -%> | |
|
32 | </tbody> | |
|
33 | </table> | |
|
34 | ||
|
35 | <% else -%> | |
|
36 | <table class="filecontent CodeRay"> | |
|
37 | <thead> | |
|
38 | <tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr> | |
|
39 | <% unless @rev.nil? -%> | |
|
40 | <tr> | |
|
41 | <th>@<%= format_revision @rev %></th> | |
|
42 | <th>@<%= format_revision @rev_to %></th> | |
|
43 | <th></th> | |
|
44 | </tr> | |
|
45 | <% end -%> | |
|
46 | </thead> | |
|
47 | <tbody> | |
|
48 | <% prev_line_left, prev_line_right = nil, nil -%> | |
|
49 | <% table_file.keys.sort.each do |key, line| %> | |
|
50 | <% 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) -%> | |
|
51 | <tr class="spacing"><td colspan="3"></td></tr> | |
|
52 | <% end -%> | |
|
53 | <tr> | |
|
54 | <th class="line-num"><%= table_file[key].nb_line_left %></th> | |
|
55 | <th class="line-num"><%= table_file[key].nb_line_right %></th> | |
|
56 | <% if table_file[key].line_left.empty? -%> | |
|
57 | <td class="line-code <%= table_file[key].type_diff_right %>"> | |
|
58 | <pre><%=to_utf8 table_file[key].line_right %></pre> | |
|
59 | </td> | |
|
60 | <% else -%> | |
|
61 | <td class="line-code <%= table_file[key].type_diff_left %>"> | |
|
62 | <pre><%=to_utf8 table_file[key].line_left %></pre> | |
|
63 | </td> | |
|
64 | <% end -%> | |
|
65 | </tr> | |
|
66 | <% prev_line_left = table_file[key].nb_line_left.to_i if table_file[key].nb_line_left.to_i > 0 -%> | |
|
67 | <% prev_line_right = table_file[key].nb_line_right.to_i if table_file[key].nb_line_right.to_i > 0 -%> | |
|
68 | <% end -%> | |
|
69 | </tbody> | |
|
70 | </table> | |
|
71 | <% end -%> | |
|
72 | ||
|
73 | </div> | |
|
74 | <% end -%> |
@@ -1,96 +1,27 | |||
|
1 | 1 | <h2><%= l(:label_revision) %> <%= format_revision(@rev) %> <%= @path.gsub(/^.*\//, '') %></h2> |
|
2 | 2 | |
|
3 | 3 | <!-- Choose view type --> |
|
4 | 4 | <% form_tag({ :controller => 'repositories', :action => 'diff'}, :method => 'get') do %> |
|
5 | 5 | <% params.each do |k, p| %> |
|
6 | 6 | <% if k != "type" %> |
|
7 | 7 | <%= hidden_field_tag(k,p) %> |
|
8 | 8 | <% end %> |
|
9 | 9 | <% end %> |
|
10 | 10 | <p><label><%= l(:label_view_diff) %></label> |
|
11 | 11 | <%= select_tag 'type', options_for_select([[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], @diff_type), :onchange => "if (this.value != '') {this.form.submit()}" %></p> |
|
12 | 12 | <% end %> |
|
13 | 13 | |
|
14 | 14 | <% cache(@cache_key) do -%> |
|
15 | <% Redmine::UnifiedDiff.new(@diff, @diff_type).each do |table_file| -%> | |
|
16 | <div class="autoscroll"> | |
|
17 | <% if @diff_type == 'sbs' -%> | |
|
18 | <table class="filecontent CodeRay"> | |
|
19 | <thead> | |
|
20 | <tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr> | |
|
21 | <tr> | |
|
22 | <th colspan="2">@<%= format_revision @rev %></th> | |
|
23 | <th colspan="2">@<%= format_revision @rev_to %></th> | |
|
24 | </tr> | |
|
25 | </thead> | |
|
26 | <tbody> | |
|
27 | <% prev_line_left, prev_line_right = nil, nil -%> | |
|
28 | <% table_file.keys.sort.each do |key| -%> | |
|
29 | <% 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) -%> | |
|
30 | <tr class="spacing"><td colspan="4"></td></tr> | |
|
31 | <% end -%> | |
|
32 | <tr> | |
|
33 | <th class="line-num"><%= table_file[key].nb_line_left %></th> | |
|
34 | <td class="line-code <%= table_file[key].type_diff_left %>"> | |
|
35 | <pre><%=to_utf8 table_file[key].line_left %></pre> | |
|
36 | </td> | |
|
37 | <th class="line-num"><%= table_file[key].nb_line_right %></th> | |
|
38 | <td class="line-code <%= table_file[key].type_diff_right %>"> | |
|
39 | <pre><%=to_utf8 table_file[key].line_right %></pre> | |
|
40 | </td> | |
|
41 | </tr> | |
|
42 | <% prev_line_left, prev_line_right = table_file[key].nb_line_left.to_i, table_file[key].nb_line_right.to_i -%> | |
|
43 | <% end -%> | |
|
44 | </tbody> | |
|
45 | </table> | |
|
46 | ||
|
47 | <% else -%> | |
|
48 | <table class="filecontent CodeRay"> | |
|
49 | <thead> | |
|
50 | <tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr> | |
|
51 | <tr> | |
|
52 | <th>@<%= format_revision @rev %></th> | |
|
53 | <th>@<%= format_revision @rev_to %></th> | |
|
54 | <th></th> | |
|
55 | </tr> | |
|
56 | </thead> | |
|
57 | <tbody> | |
|
58 | <% prev_line_left, prev_line_right = nil, nil -%> | |
|
59 | <% table_file.keys.sort.each do |key, line| %> | |
|
60 | <% 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) -%> | |
|
61 | <tr class="spacing"><td colspan="3"></td></tr> | |
|
62 | <% end -%> | |
|
63 | <tr> | |
|
64 | <th class="line-num"><%= table_file[key].nb_line_left %></th> | |
|
65 | <th class="line-num"><%= table_file[key].nb_line_right %></th> | |
|
66 | <% if table_file[key].line_left.empty? -%> | |
|
67 | <td class="line-code <%= table_file[key].type_diff_right %>"> | |
|
68 | <pre><%=to_utf8 table_file[key].line_right %></pre> | |
|
69 | </td> | |
|
70 | <% else -%> | |
|
71 | <td class="line-code <%= table_file[key].type_diff_left %>"> | |
|
72 | <pre><%=to_utf8 table_file[key].line_left %></pre> | |
|
73 | </td> | |
|
74 | <% end -%> | |
|
75 | </tr> | |
|
76 | <% prev_line_left = table_file[key].nb_line_left.to_i if table_file[key].nb_line_left.to_i > 0 -%> | |
|
77 | <% prev_line_right = table_file[key].nb_line_right.to_i if table_file[key].nb_line_right.to_i > 0 -%> | |
|
78 | <% end -%> | |
|
79 | </tbody> | |
|
80 | </table> | |
|
81 | <% end -%> | |
|
82 | ||
|
83 | </div> | |
|
84 | <% end -%> | |
|
15 | <%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type} %> | |
|
85 | 16 | <% end -%> |
|
86 | 17 | |
|
87 | 18 | <p class="other-formats"> |
|
88 | 19 | <%= l(:label_export_to) %> |
|
89 | 20 | <span><%= link_to 'Unified diff', params.merge(:format => 'diff') %></span> |
|
90 | 21 | </p> |
|
91 | 22 | |
|
92 | 23 | <% html_title(with_leading_slash(@path), 'Diff') -%> |
|
93 | 24 | |
|
94 | 25 | <% content_for :header_tags do %> |
|
95 | 26 | <%= stylesheet_link_tag "scm" %> |
|
96 | 27 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now