2016-11-29 18:22:43 +08:00
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
2016-11-29 17:05:14 +08:00
|
|
|
<table class="filecontent syntaxhl">
|
|
|
|
<tbody>
|
|
|
|
<% diff = ActiveSupport::JSON.decode(change.to_json) %>
|
|
|
|
<% diff = OpenStruct.new(diff) %>
|
|
|
|
<% @diff_file = Trustie::Gitlab::Diff::File.new(diff) %>
|
|
|
|
<% @diff_file.diff_lines.each_with_index do |line, index| %>
|
|
|
|
<% type = line.type %>
|
|
|
|
<% last_line = line.new_pos.to_s %>
|
|
|
|
<% line_old = line.old_pos.to_s %>
|
|
|
|
|
|
|
|
<% if type.nil? || type == "match" %>
|
|
|
|
<tr class="line_holder" >
|
|
|
|
<td class="old_line">
|
|
|
|
<a><%= type == "match" ? "..." : line_old.center(4) %></a>
|
|
|
|
</td>
|
|
|
|
<td class="new_line" >
|
|
|
|
<a><%= type == "match" ? "..." : last_line.center(4) %></a>
|
|
|
|
</td>
|
|
|
|
<td class="line_content noteable_line <%= 'c_grey' if type == "match" %>" >
|
2016-11-29 18:22:43 +08:00
|
|
|
<pre style="width:auto;overflow: auto; "><%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %></pre>
|
2016-11-29 17:05:14 +08:00
|
|
|
</td>
|
2016-11-29 10:52:57 +08:00
|
|
|
</tr>
|
|
|
|
<% else %>
|
|
|
|
<% old_line = type == 'new' ? ' '*4: line_old %>
|
|
|
|
<% new_line = type == 'old' ? ' '*4: last_line %>
|
2016-11-29 17:05:14 +08:00
|
|
|
<tr class="<%= type == 'old' ? 'line_holder old' : 'line_holder new' %>" >
|
|
|
|
<td class="old_line">
|
|
|
|
<a><%= old_line.to_s.center(4) %></a>
|
|
|
|
</td>
|
|
|
|
<td class="new_line" data-linenumber="2">
|
|
|
|
<a><%= new_line.to_s.center(4) %></a>
|
|
|
|
</td>
|
|
|
|
<td class="<%= type == 'old' ? 'line_content noteable_line old' : 'line_content new noteable_line' %> " >
|
2016-11-29 18:22:43 +08:00
|
|
|
<pre style="width:auto;overflow: auto; "><%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %></pre>
|
2016-11-29 17:05:14 +08:00
|
|
|
</td>
|
2016-11-29 10:52:57 +08:00
|
|
|
</tr>
|
|
|
|
<% end %>
|
2016-11-29 17:05:14 +08:00
|
|
|
<% end %>
|
|
|
|
<tr>
|
|
|
|
<td class=" old_line " data-linenumber="5">
|
|
|
|
...
|
|
|
|
</td>
|
|
|
|
<td class="new_line " data-linenumber="5">
|
|
|
|
...
|
|
|
|
</td>
|
|
|
|
<td class="line_content "></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|