2011-10-08 23:36:38 +02:00
|
|
|
.file_stats
|
|
|
|
- @commit.diffs.each do |diff|
|
|
|
|
- if diff.deleted_file
|
|
|
|
%span.removed_file
|
|
|
|
%a{:href => "##{diff.a_path}"}
|
|
|
|
= diff.a_path
|
|
|
|
= image_tag "blueprint_delete.png"
|
|
|
|
- elsif diff.renamed_file
|
|
|
|
%span.moved_file
|
|
|
|
%a{:href => "##{diff.b_path}"}
|
|
|
|
= diff.a_path
|
|
|
|
= "->"
|
|
|
|
= diff.b_path
|
|
|
|
= image_tag "blueprint_notice.png"
|
|
|
|
- elsif diff.new_file
|
|
|
|
%span.new_file
|
|
|
|
%a{:href => "##{diff.b_path}"}
|
|
|
|
= diff.b_path
|
|
|
|
= image_tag "blueprint_add.png"
|
|
|
|
- else
|
|
|
|
%span.edit_file
|
|
|
|
%a{:href => "##{diff.b_path}"}
|
|
|
|
= diff.b_path
|
|
|
|
= image_tag "blueprint_info.png"
|
|
|
|
- @commit.diffs.each do |diff|
|
|
|
|
- next if diff.diff.empty?
|
|
|
|
- file = (@commit.tree / diff.b_path)
|
|
|
|
- next unless file
|
|
|
|
.diff_file
|
|
|
|
.diff_file_header
|
|
|
|
- if diff.deleted_file
|
|
|
|
%strong{:id => "#{diff.b_path}"}= diff.a_path
|
|
|
|
- else
|
2011-10-21 20:14:55 +02:00
|
|
|
= link_to tree_file_project_path(@project, @commit.id, diff.b_path) do
|
|
|
|
%strong{:id => "#{diff.b_path}"}= diff.b_path
|
2011-10-08 23:36:38 +02:00
|
|
|
%br/
|
|
|
|
.diff_file_content
|
2011-10-20 21:00:00 +02:00
|
|
|
- if file.text?
|
2011-10-08 23:36:38 +02:00
|
|
|
- lines_arr = diff.diff.lines.to_a
|
|
|
|
- line_old = lines_arr[2].match(/-(\d)/)[0].to_i.abs rescue 0
|
|
|
|
- line_new = lines_arr[2].match(/\+(\d)/)[0].to_i.abs rescue 0
|
|
|
|
- lines = lines_arr[3..-1].join
|
|
|
|
- lines.each_line do |line|
|
|
|
|
= diff_line(line, line_new, line_old)
|
|
|
|
- if line[0] == "+"
|
|
|
|
- line_new += 1
|
|
|
|
- elsif
|
|
|
|
- line[0] == "-"
|
|
|
|
- line_old += 1
|
|
|
|
- else
|
|
|
|
- line_new += 1
|
|
|
|
- line_old += 1
|
2011-10-20 21:00:00 +02:00
|
|
|
- elsif file.image?
|
2011-10-08 23:36:38 +02:00
|
|
|
.diff_file_content_image
|
2011-10-20 21:00:00 +02:00
|
|
|
%img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
|
2011-10-08 23:36:38 +02:00
|
|
|
- else
|
|
|
|
%p
|
|
|
|
%center No preview for this file type
|