gitlabhq/app/views/commits/_diffs.html.haml

48 lines
1.9 KiB
Plaintext
Raw Normal View History

2012-04-06 00:00:15 +02:00
- if @suppress_diff
.alert-message.block-message
%p
%strong Warning! Large commit with more then 200 files changed.
2012-04-06 00:00:15 +02:00
%p To prevent performance issue we rejected diff information.
%p
But if you still want to see diff
= link_to "click this link", project_commit_path(@project, @commit.id, force_show_diff: true), class: "dark"
2012-04-06 00:00:15 +02:00
%p.cgray
Showing #{pluralize(diffs.count, "changed file")}
2011-11-21 08:16:10 +01:00
.file_stats
= render "commits/diff_head", diffs: diffs
2012-04-06 00:00:15 +02:00
- unless @suppress_diff
- diffs.each_with_index do |diff, i|
- next if diff.diff.empty?
2012-04-11 22:03:56 +02:00
- file = (@commit.tree / diff.new_path)
- file = (@commit.prev_commit.tree / diff.old_path) unless file
2012-04-06 00:00:15 +02:00
- next unless file
.diff_file
.diff_file_header
- if diff.deleted_file
2012-05-15 18:35:18 +02:00
%i.icon-file
%span{id: "#{diff.old_path}"}= diff.old_path
2012-04-06 00:00:15 +02:00
- else
2012-04-11 22:03:56 +02:00
= link_to tree_file_project_ref_path(@project, @commit.id, diff.new_path) do
2012-05-15 18:35:18 +02:00
%i.icon-file
%span{id: "#{diff.new_path}"}= diff.new_path
2012-04-06 00:00:15 +02:00
%br/
.diff_file_content
2012-07-05 08:35:23 +02:00
-# Skipp all non non-supported blobs
- next unless file.respond_to?('text?')
2012-04-06 00:00:15 +02:00
- if file.text?
= render "commits/text_file", diff: diff, index: i
2012-04-06 00:00:15 +02:00
- elsif file.image?
2012-07-05 22:19:37 +02:00
- if diff.renamed_file || diff.new_file || diff.deleted_file
.diff_file_content_image
%img{class: image_diff_class(diff), src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
2012-07-05 22:19:37 +02:00
- else
- old_file = (@commit.prev_commit.tree / diff.old_path)
.diff_file_content_image.img_compared
%img{class: "diff_image_removed", src: "data:#{file.mime_type};base64,#{Base64.encode64(old_file.data)}"}
%img{class: "diff_image_added", src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
2012-04-06 00:00:15 +02:00
- else
%p.nothing_here_message No preview for this file type