1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-24 17:31:14 +00:00
redmine/app/views/common/_diff.html.erb
Go MAEDA 6a46743cd3 Fix code copying in common browsers (#36580).
Patch by Vitaly vit9696.


git-svn-id: http://svn.redmine.org/redmine/trunk@21415 e93f8b46-1217-0410-a6f0-8f06a7374b81
2022-02-19 07:36:40 +00:00

75 lines
2.0 KiB
Plaintext

<% diff = Redmine::UnifiedDiff.new(
diff, :type => diff_type,
:max_lines => Setting.diff_max_lines_displayed.to_i,
:style => diff_style) -%>
<% diff.each do |table_file| -%>
<div class="autoscroll">
<% if diff.diff_type == 'sbs' -%>
<table class="filecontent diffcontent">
<thead>
<tr>
<th colspan="4" class="filename">
<% if table_file.previous_file_name %>
<span class="previous-filename"><%= table_file.previous_file_name %> →</span>
<% end %>
<%= table_file.file_name %>
</th>
</tr>
</thead>
<tbody>
<% table_file.each_line do |spacing, line| -%>
<% if spacing -%>
<tr class="spacing">
<th class="line-num" data-txt="..."></th><td></td><th class="line-num" data-txt="..."></th><td></td>
</tr>
<% end -%>
<tr>
<th class="line-num" data-txt="<%= line.nb_line_left %>"></th>
<td class="line-code <%= line.type_diff_left %>">
<div><%= line.html_line_left.html_safe %></div>
</td>
<th class="line-num" data-txt="<%= line.nb_line_right %>"></th>
<td class="line-code <%= line.type_diff_right %>">
<div><%= line.html_line_right.html_safe %></div>
</td>
</tr>
<% end -%>
</tbody>
</table>
<% else -%>
<table class="filecontent diffcontent">
<thead>
<tr>
<th colspan="3" class="filename">
<% if table_file.previous_file_name %>
<span class="previous-filename"><%= table_file.previous_file_name %> →</span>
<% end %>
<%= table_file.file_name %>
</th>
</tr>
</thead>
<tbody>
<% table_file.each_line do |spacing, line| %>
<% if spacing -%>
<tr class="spacing">
<th class="line-num">...</th><th class="line-num">...</th><td></td>
</tr>
<% end -%>
<tr>
<th class="line-num" data-txt="<%= line.nb_line_left %>"></th>
<th class="line-num" data-txt="<%= line.nb_line_right %>"></th>
<td class="line-code <%= line.type_diff %>">
<div><%= line.html_line.html_safe %></div>
</td>
</tr>
<% end -%>
</tbody>
</table>
<% end -%>
</div>
<% end -%>
<%= l(:text_diff_truncated) if diff.truncated? %>