diff options
author | Koen Punt <koen@koenpunt.nl> | 2012-11-18 17:41:41 +0100 |
---|---|---|
committer | Koen Punt <koen@koenpunt.nl> | 2012-11-18 17:41:41 +0100 |
commit | 3ac1f9459a481fa77be2c0c1b68d4f1ccc5fe9f9 (patch) | |
tree | 3b1e33a939e47b3c3036edfab01a65a08418f196 /app/views/commits | |
parent | b339c747a9943e9961239a234dcd6e16566a53e1 (diff) | |
download | gitlab-ce-3ac1f9459a481fa77be2c0c1b68d4f1ccc5fe9f9.tar.gz |
Optimized commit diff views, now showing file size and file mode changes
Replaced commit status images (diff_file_*.png) with fontawesome icons
Diffstat (limited to 'app/views/commits')
-rw-r--r-- | app/views/commits/_diff_head.html.haml | 26 | ||||
-rw-r--r-- | app/views/commits/_diffs.html.haml | 38 |
2 files changed, 39 insertions, 25 deletions
diff --git a/app/views/commits/_diff_head.html.haml b/app/views/commits/_diff_head.html.haml index 710e8857649..5aa542287fe 100644 --- a/app/views/commits/_diff_head.html.haml +++ b/app/views/commits/_diff_head.html.haml @@ -1,26 +1,26 @@ %ul.bordered-list - - diffs.each do |diff| + - diffs.each_with_index do |diff, i| %li - if diff.deleted_file - %span.removed_file - %a{href: "##{diff.old_path}"} + %span.deleted-file + %a{href: "#diff-#{i}"} + %i.icon-minus = diff.old_path - = image_tag "diff_file_delete.png" - elsif diff.renamed_file - %span.moved_file - %a{href: "##{diff.new_path}"} + %span.renamed-file + %a{href: "#diff-#{i}"} + %i.icon-minus = diff.old_path = "->" = diff.new_path - = image_tag "diff_file_notice.png" - elsif diff.new_file - %span.new_file - %a{href: "##{diff.new_path}"} + %span.new-file + %a{href: "#diff-#{i}"} + %i.icon-plus = diff.new_path - = image_tag "diff_file_add.png" - else - %span.edit_file - %a{href: "##{diff.new_path}"} + %span.edit-file + %a{href: "#diff-#{i}"} + %i.icon-adjust = diff.new_path - = image_tag "diff_file_info.png" diff --git a/app/views/commits/_diffs.html.haml b/app/views/commits/_diffs.html.haml index 70fff53c1d1..6ffc6d8b057 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/commits/_diffs.html.haml @@ -9,7 +9,7 @@ %p.cgray Showing #{pluralize(diffs.count, "changed file")} -.file_stats +.file-stats = render "commits/diff_head", diffs: diffs - unless @suppress_diff @@ -18,30 +18,44 @@ - file = (@commit.tree / diff.new_path) - file = (@commit.prev_commit.tree / diff.old_path) unless file - next unless file - .diff_file + .diff_file{id: "diff-#{i}"} .diff_file_header - if diff.deleted_file - %i.icon-file - %span{id: "#{diff.old_path}"}= diff.old_path + %span= diff.old_path + + - if @commit.prev_commit + = link_to project_tree_path(@project, tree_join(@commit.prev_commit_id, diff.new_path)), {:class => 'btn right view-commit'} do + View file @ + %span.commit-short-id= @commit.short_id(6) - else - = link_to project_tree_path(@project, tree_join(@commit.id, diff.new_path)) do - %i.icon-file - %span{id: "#{diff.new_path}"}= diff.new_path + %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_tree_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn right view-commit'} do + View file @ + %span.commit-short-id= @commit.short_id(6) + %br/ .diff_file_content -# Skipp all non non-supported blobs - next unless file.respond_to?('text?') - - if file.text? = render "commits/text_file", diff: diff, index: i - elsif file.image? + - old_file = (@commit.prev_commit.tree / diff.old_path) - 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)}"} + .image{class: image_diff_class(diff)} + %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} + %div.image-info= "#{number_to_human_size file.size}" - 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)}"} + .image.diff_removed + %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(old_file.data)}"} + %div.image-info= "#{number_to_human_size file.size}" + .image.diff_added + %img{src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} + %div.image-info= "#{number_to_human_size file.size}" - else %p.nothing_here_message No preview for this file type |