From 4d2278e7c64548137e1cfb9e4e56f842f15c29cb Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Sat, 17 Nov 2012 22:45:00 +0100 Subject: [PATCH] Rename commits/text_file partial to text_diff --- app/views/commits/_diffs.html.haml | 4 ++-- app/views/commits/_text_diff.html.haml | 23 +++++++++++++++++++++++ app/views/commits/_text_file.html.haml | 23 ----------------------- 3 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 app/views/commits/_text_diff.html.haml delete mode 100644 app/views/commits/_text_file.html.haml diff --git a/app/views/commits/_diffs.html.haml b/app/views/commits/_diffs.html.haml index e7733f0..7fe45aa 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/commits/_diffs.html.haml @@ -38,10 +38,10 @@ %br/ .diff_file_content - -# Skipp all non non-supported blobs + -# Skip all non-supported blobs - next unless file.respond_to?('text?') - if file.text? - = render "commits/text_file", diff: diff, index: i + = render "commits/text_diff", diff: diff, index: i - elsif file.image? - old_file = (@commit.prev_commit.tree / diff.old_path) if !@commit.prev_commit.nil? - if diff.renamed_file || diff.new_file || diff.deleted_file diff --git a/app/views/commits/_text_diff.html.haml b/app/views/commits/_text_diff.html.haml new file mode 100644 index 0000000..3d9014c --- /dev/null +++ b/app/views/commits/_text_diff.html.haml @@ -0,0 +1,23 @@ +- too_big = diff.diff.lines.count > 1000 +- if too_big + %a.supp_diff_link Diff suppressed. Click to show + +%table{class: "#{'hide' if too_big}"} + - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| + %tr.line_holder{ id: line_code } + - if type == "match" + %td.old_line= "..." + %td.new_line= "..." + %td.line_content.matched= line + - else + %td.old_line + = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code + - if @comments_allowed + = render "notes/diff_note_link", line_code: line_code + %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  " + + - if @reply_allowed + - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) + - unless comments.empty? + = render "notes/diff_notes_with_reply", notes: comments diff --git a/app/views/commits/_text_file.html.haml b/app/views/commits/_text_file.html.haml deleted file mode 100644 index 3d9014c..0000000 --- a/app/views/commits/_text_file.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- too_big = diff.diff.lines.count > 1000 -- if too_big - %a.supp_diff_link Diff suppressed. Click to show - -%table{class: "#{'hide' if too_big}"} - - each_diff_line(diff.diff.lines.to_a, index) do |line, type, line_code, line_new, line_old| - %tr.line_holder{ id: line_code } - - if type == "match" - %td.old_line= "..." - %td.new_line= "..." - %td.line_content.matched= line - - else - %td.old_line - = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code - - if @comments_allowed - = render "notes/diff_note_link", line_code: line_code - %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code - %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  " - - - if @reply_allowed - - comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at) - - unless comments.empty? - = render "notes/diff_notes_with_reply", notes: comments -- libgit2 0.21.2