diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-23 19:47:22 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-23 19:47:22 +0300 |
commit | 2ed7cbfba4ff3c6a4cf3e72515a0375544998de0 (patch) | |
tree | ae6d7530745c80633cd993c99f7820e1452f3e1b /app/views/projects/commits/_diffs.html.haml | |
parent | 95791316f4037273af7b747ce1851d5f4e46933f (diff) | |
download | gitlab-ce-2ed7cbfba4ff3c6a4cf3e72515a0375544998de0.tar.gz |
Move projects controllers/views in Projects module
Diffstat (limited to 'app/views/projects/commits/_diffs.html.haml')
-rw-r--r-- | app/views/projects/commits/_diffs.html.haml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml new file mode 100644 index 00000000000..8e3cbff8f3e --- /dev/null +++ b/app/views/projects/commits/_diffs.html.haml @@ -0,0 +1,49 @@ +- if @suppress_diff + .alert.alert-block + %p + %strong Warning! Large commit with more than #{Commit::DIFF_SAFE_SIZE} files changed. + %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, force_show_diff: true), class: "underlined_link" + +%p.cgray + Showing #{pluralize(diffs.count, "changed file")} +.file-stats + = render "projects/commits/diff_head", diffs: diffs + +.files + - unless @suppress_diff + - diffs.each_with_index do |diff, i| + - next if diff.diff.empty? + - file = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, diff.new_path) + - file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) unless file.exists? + - next unless file.exists? + .file{id: "diff-#{i}"} + .header + - if diff.deleted_file + %span= diff.old_path + + - if @commit.parent_ids.present? + = link_to project_blob_path(@project, tree_join(@commit.parent_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do + View file @ + %span.commit-short-id= @commit.short_id(6) + - else + %span= diff.new_path + - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode + %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" + + = link_to project_blob_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do + View file @ + %span.commit-short-id= @commit.short_id(6) + + .content + -# Skipp all non non-supported blobs + - next unless file.respond_to?('text?') + - if file.text? + = render "projects/commits/text_file", diff: diff, index: i + - elsif file.image? + - old_file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id + = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i + - else + %p.nothing_here_message No preview for this file type |