Move diff viewer to a partial.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1515 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
b78b62df8d
commit
e833cab30e
|
@ -0,0 +1,74 @@
|
||||||
|
<% Redmine::UnifiedDiff.new(diff, diff_type).each do |table_file| -%>
|
||||||
|
<div class="autoscroll">
|
||||||
|
<% if diff_type == 'sbs' -%>
|
||||||
|
<table class="filecontent CodeRay">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr>
|
||||||
|
<% unless @rev.nil? -%>
|
||||||
|
<tr>
|
||||||
|
<th colspan="2">@<%= format_revision @rev %></th>
|
||||||
|
<th colspan="2">@<%= format_revision @rev_to %></th>
|
||||||
|
</tr>
|
||||||
|
<% end -%>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% prev_line_left, prev_line_right = nil, nil -%>
|
||||||
|
<% table_file.keys.sort.each do |key| -%>
|
||||||
|
<% 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) -%>
|
||||||
|
<tr class="spacing"><td colspan="4"></td></tr>
|
||||||
|
<% end -%>
|
||||||
|
<tr>
|
||||||
|
<th class="line-num"><%= table_file[key].nb_line_left %></th>
|
||||||
|
<td class="line-code <%= table_file[key].type_diff_left %>">
|
||||||
|
<pre><%=to_utf8 table_file[key].line_left %></pre>
|
||||||
|
</td>
|
||||||
|
<th class="line-num"><%= table_file[key].nb_line_right %></th>
|
||||||
|
<td class="line-code <%= table_file[key].type_diff_right %>">
|
||||||
|
<pre><%=to_utf8 table_file[key].line_right %></pre>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% prev_line_left, prev_line_right = table_file[key].nb_line_left.to_i, table_file[key].nb_line_right.to_i -%>
|
||||||
|
<% end -%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<% else -%>
|
||||||
|
<table class="filecontent CodeRay">
|
||||||
|
<thead>
|
||||||
|
<tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr>
|
||||||
|
<% unless @rev.nil? -%>
|
||||||
|
<tr>
|
||||||
|
<th>@<%= format_revision @rev %></th>
|
||||||
|
<th>@<%= format_revision @rev_to %></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
<% end -%>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% prev_line_left, prev_line_right = nil, nil -%>
|
||||||
|
<% table_file.keys.sort.each do |key, line| %>
|
||||||
|
<% 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) -%>
|
||||||
|
<tr class="spacing"><td colspan="3"></td></tr>
|
||||||
|
<% end -%>
|
||||||
|
<tr>
|
||||||
|
<th class="line-num"><%= table_file[key].nb_line_left %></th>
|
||||||
|
<th class="line-num"><%= table_file[key].nb_line_right %></th>
|
||||||
|
<% if table_file[key].line_left.empty? -%>
|
||||||
|
<td class="line-code <%= table_file[key].type_diff_right %>">
|
||||||
|
<pre><%=to_utf8 table_file[key].line_right %></pre>
|
||||||
|
</td>
|
||||||
|
<% else -%>
|
||||||
|
<td class="line-code <%= table_file[key].type_diff_left %>">
|
||||||
|
<pre><%=to_utf8 table_file[key].line_left %></pre>
|
||||||
|
</td>
|
||||||
|
<% end -%>
|
||||||
|
</tr>
|
||||||
|
<% prev_line_left = table_file[key].nb_line_left.to_i if table_file[key].nb_line_left.to_i > 0 -%>
|
||||||
|
<% prev_line_right = table_file[key].nb_line_right.to_i if table_file[key].nb_line_right.to_i > 0 -%>
|
||||||
|
<% end -%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% end -%>
|
|
@ -12,76 +12,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% cache(@cache_key) do -%>
|
<% cache(@cache_key) do -%>
|
||||||
<% Redmine::UnifiedDiff.new(@diff, @diff_type).each do |table_file| -%>
|
<%= render :partial => 'common/diff', :locals => {:diff => @diff, :diff_type => @diff_type} %>
|
||||||
<div class="autoscroll">
|
|
||||||
<% if @diff_type == 'sbs' -%>
|
|
||||||
<table class="filecontent CodeRay">
|
|
||||||
<thead>
|
|
||||||
<tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2">@<%= format_revision @rev %></th>
|
|
||||||
<th colspan="2">@<%= format_revision @rev_to %></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% prev_line_left, prev_line_right = nil, nil -%>
|
|
||||||
<% table_file.keys.sort.each do |key| -%>
|
|
||||||
<% 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) -%>
|
|
||||||
<tr class="spacing"><td colspan="4"></td></tr>
|
|
||||||
<% end -%>
|
|
||||||
<tr>
|
|
||||||
<th class="line-num"><%= table_file[key].nb_line_left %></th>
|
|
||||||
<td class="line-code <%= table_file[key].type_diff_left %>">
|
|
||||||
<pre><%=to_utf8 table_file[key].line_left %></pre>
|
|
||||||
</td>
|
|
||||||
<th class="line-num"><%= table_file[key].nb_line_right %></th>
|
|
||||||
<td class="line-code <%= table_file[key].type_diff_right %>">
|
|
||||||
<pre><%=to_utf8 table_file[key].line_right %></pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% prev_line_left, prev_line_right = table_file[key].nb_line_left.to_i, table_file[key].nb_line_right.to_i -%>
|
|
||||||
<% end -%>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<% else -%>
|
|
||||||
<table class="filecontent CodeRay">
|
|
||||||
<thead>
|
|
||||||
<tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr>
|
|
||||||
<tr>
|
|
||||||
<th>@<%= format_revision @rev %></th>
|
|
||||||
<th>@<%= format_revision @rev_to %></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% prev_line_left, prev_line_right = nil, nil -%>
|
|
||||||
<% table_file.keys.sort.each do |key, line| %>
|
|
||||||
<% 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) -%>
|
|
||||||
<tr class="spacing"><td colspan="3"></td></tr>
|
|
||||||
<% end -%>
|
|
||||||
<tr>
|
|
||||||
<th class="line-num"><%= table_file[key].nb_line_left %></th>
|
|
||||||
<th class="line-num"><%= table_file[key].nb_line_right %></th>
|
|
||||||
<% if table_file[key].line_left.empty? -%>
|
|
||||||
<td class="line-code <%= table_file[key].type_diff_right %>">
|
|
||||||
<pre><%=to_utf8 table_file[key].line_right %></pre>
|
|
||||||
</td>
|
|
||||||
<% else -%>
|
|
||||||
<td class="line-code <%= table_file[key].type_diff_left %>">
|
|
||||||
<pre><%=to_utf8 table_file[key].line_left %></pre>
|
|
||||||
</td>
|
|
||||||
<% end -%>
|
|
||||||
</tr>
|
|
||||||
<% prev_line_left = table_file[key].nb_line_left.to_i if table_file[key].nb_line_left.to_i > 0 -%>
|
|
||||||
<% prev_line_right = table_file[key].nb_line_right.to_i if table_file[key].nb_line_right.to_i > 0 -%>
|
|
||||||
<% end -%>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<% end -%>
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<p class="other-formats">
|
<p class="other-formats">
|
||||||
|
|
Loading…
Reference in New Issue