2011-12-01 00:51:04 +01:00
|
|
|
%table
|
|
|
|
- line_old = 0
|
|
|
|
- line_new = 0
|
2011-12-30 14:41:39 +01:00
|
|
|
- diff_str = diff.diff
|
2011-12-01 08:59:49 +01:00
|
|
|
- lines_arr = diff_str.lines.to_a
|
2011-12-01 00:51:04 +01:00
|
|
|
- lines_arr.each do |line|
|
|
|
|
- next if line.match(/^--- \/dev\/null/)
|
|
|
|
- next if line.match(/^--- a/)
|
|
|
|
- next if line.match(/^\+\+\+ b/)
|
|
|
|
- if line.match(/^@@ -/)
|
|
|
|
- line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
|
|
|
|
- line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
|
2012-01-20 08:51:48 +01:00
|
|
|
%tr.line_holder
|
|
|
|
%td.old_line= "..."
|
|
|
|
%td.new_line= "..."
|
|
|
|
%td.line_content
|
2011-12-01 00:51:04 +01:00
|
|
|
- next
|
2011-10-25 20:04:31 +02:00
|
|
|
|
2011-12-01 00:51:04 +01:00
|
|
|
- full_line = html_escape(line.gsub(/\n/, ''))
|
|
|
|
%tr.line_holder
|
|
|
|
%td.old_line
|
|
|
|
= link_to raw(diff_line_class(line) == "new" ? " " : line_old), "#OLD#{index}-#{line_old}", :id => "OLD#{index}-#{line_old}"
|
|
|
|
%td.new_line
|
|
|
|
= link_to raw(diff_line_class(line) == "old" ? " " : line_new) , "#NEW#{index}-#{line_new}", :id => "NEW#{index}-#{line_new}"
|
2012-01-11 23:26:01 +01:00
|
|
|
%td.line_content{:class => "#{diff_line_class(full_line)} #{build_line_code(line, index, line_new, line_old)}", "line_code" => build_line_code(line, index, line_new, line_old)}= raw "#{full_line} "
|
2012-01-10 21:08:46 +01:00
|
|
|
- comments = @line_notes.select { |n| n.for_line?(index, line_old, line_new) }.sort_by(&:created_at).reverse
|
|
|
|
- unless comments.empty?
|
2012-01-11 23:26:01 +01:00
|
|
|
- comments.each do |note|
|
|
|
|
= render "notes/per_line_show", :note => note
|
2011-12-01 00:51:04 +01:00
|
|
|
- if line[0] == "+"
|
|
|
|
- line_new += 1
|
|
|
|
- elsif line[0] == "-"
|
|
|
|
- line_old += 1
|
|
|
|
- else
|
|
|
|
- line_new += 1
|
|
|
|
- line_old += 1
|