<% 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" %> <% else %> <% old_line = type == 'new' ? ' '*4: line_old %> <% new_line = type == 'old' ? ' '*4: last_line %> <% end %> <% end %>
<%= type == "match" ? "..." : line_old.center(4) %> <%= type == "match" ? "..." : last_line.center(4) %> " >
<%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %>
<%= old_line.to_s.center(4) %> <%= new_line.to_s.center(4) %>
<%= Redmine::CodesetUtil.replace_invalid_utf8(line.text).html_safe %>
... ...