Commit bfd4494890c80e131d606c5026ea3e1146e7d4d0
Exists in
spb-stable
and in
3 other branches
Merge branch 'show_diff' into 'master'
Show note diff if diff exists
Showing
1 changed file
with
24 additions
and
23 deletions
Show diff stats
app/views/projects/notes/_discussion_diff.html.haml
| 1 | - diff = note.diff | 1 | - diff = note.diff |
| 2 | -.diff-file | ||
| 3 | - .diff-header | ||
| 4 | - - if diff.deleted_file | ||
| 5 | - %span= diff.old_path | ||
| 6 | - - else | ||
| 7 | - %span= diff.new_path | ||
| 8 | - - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode | ||
| 9 | - %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" | ||
| 10 | - %br/ | ||
| 11 | - .diff-content | ||
| 12 | - %table | ||
| 13 | - - each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old| | ||
| 14 | - %tr.line_holder{ id: line_code } | ||
| 15 | - - if type == "match" | ||
| 16 | - %td.old_line= "..." | ||
| 17 | - %td.new_line= "..." | ||
| 18 | - %td.line_content.matched= line | ||
| 19 | - - else | ||
| 20 | - %td.old_line= raw(type == "new" ? " " : line_old) | ||
| 21 | - %td.new_line= raw(type == "old" ? " " : line_new) | ||
| 22 | - %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | 2 | +- if diff |
| 3 | + .diff-file | ||
| 4 | + .diff-header | ||
| 5 | + - if diff.deleted_file | ||
| 6 | + %span= diff.old_path | ||
| 7 | + - else | ||
| 8 | + %span= diff.new_path | ||
| 9 | + - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode | ||
| 10 | + %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" | ||
| 11 | + %br/ | ||
| 12 | + .diff-content | ||
| 13 | + %table | ||
| 14 | + - each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old| | ||
| 15 | + %tr.line_holder{ id: line_code } | ||
| 16 | + - if type == "match" | ||
| 17 | + %td.old_line= "..." | ||
| 18 | + %td.new_line= "..." | ||
| 19 | + %td.line_content.matched= line | ||
| 20 | + - else | ||
| 21 | + %td.old_line= raw(type == "new" ? " " : line_old) | ||
| 22 | + %td.new_line= raw(type == "old" ? " " : line_new) | ||
| 23 | + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | ||
| 23 | 24 | ||
| 24 | - - if line_code == note.line_code | ||
| 25 | - = render "projects/notes/diff_notes_with_reply", notes: discussion_notes | 25 | + - if line_code == note.line_code |
| 26 | + = render "projects/notes/diff_notes_with_reply", notes: discussion_notes |