Commit 4d2278e7c64548137e1cfb9e4e56f842f15c29cb
1 parent
6d5c29dc
Exists in
master
and in
4 other branches
Rename commits/text_file partial to text_diff
Showing
3 changed files
with
25 additions
and
25 deletions
Show diff stats
app/views/commits/_diffs.html.haml
... | ... | @@ -38,10 +38,10 @@ |
38 | 38 | |
39 | 39 | %br/ |
40 | 40 | .diff_file_content |
41 | - -# Skipp all non non-supported blobs | |
41 | + -# Skip all non-supported blobs | |
42 | 42 | - next unless file.respond_to?('text?') |
43 | 43 | - if file.text? |
44 | - = render "commits/text_file", diff: diff, index: i | |
44 | + = render "commits/text_diff", diff: diff, index: i | |
45 | 45 | - elsif file.image? |
46 | 46 | - old_file = (@commit.prev_commit.tree / diff.old_path) if !@commit.prev_commit.nil? |
47 | 47 | - if diff.renamed_file || diff.new_file || diff.deleted_file | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | +- too_big = diff.diff.lines.count > 1000 | |
2 | +- if too_big | |
3 | + %a.supp_diff_link Diff suppressed. Click to show | |
4 | + | |
5 | +%table{class: "#{'hide' if too_big}"} | |
6 | + - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| | |
7 | + %tr.line_holder{ id: line_code } | |
8 | + - if type == "match" | |
9 | + %td.old_line= "..." | |
10 | + %td.new_line= "..." | |
11 | + %td.line_content.matched= line | |
12 | + - else | |
13 | + %td.old_line | |
14 | + = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code | |
15 | + - if @comments_allowed | |
16 | + = render "notes/diff_note_link", line_code: line_code | |
17 | + %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code | |
18 | + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | |
19 | + | |
20 | + - if @reply_allowed | |
21 | + - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) | |
22 | + - unless comments.empty? | |
23 | + = render "notes/diff_notes_with_reply", notes: comments | ... | ... |
app/views/commits/_text_file.html.haml
... | ... | @@ -1,23 +0,0 @@ |
1 | -- too_big = diff.diff.lines.count > 1000 | |
2 | -- if too_big | |
3 | - %a.supp_diff_link Diff suppressed. Click to show | |
4 | - | |
5 | -%table{class: "#{'hide' if too_big}"} | |
6 | - - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| | |
7 | - %tr.line_holder{ id: line_code } | |
8 | - - if type == "match" | |
9 | - %td.old_line= "..." | |
10 | - %td.new_line= "..." | |
11 | - %td.line_content.matched= line | |
12 | - - else | |
13 | - %td.old_line | |
14 | - = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code | |
15 | - - if @comments_allowed | |
16 | - = render "notes/diff_note_link", line_code: line_code | |
17 | - %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code | |
18 | - %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} " | |
19 | - | |
20 | - - if @reply_allowed | |
21 | - - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) | |
22 | - - unless comments.empty? | |
23 | - = render "notes/diff_notes_with_reply", notes: comments |