From aca9fe80cb30bd414030b2a444d9f6048e46c0aa Mon Sep 17 00:00:00 2001 From: Florian Unglaub Date: Tue, 3 Jul 2012 08:14:07 +0200 Subject: [PATCH 1/2] fixing diffs for merge_requests when submodules are involved --- app/views/commits/_diffs.html.haml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/commits/_diffs.html.haml b/app/views/commits/_diffs.html.haml index d16ad069e58..5c7d723e631 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/commits/_diffs.html.haml @@ -29,10 +29,11 @@ %span{:id => "#{diff.new_path}"}= diff.new_path %br/ .diff_file_content - - if file.text? - = render "commits/text_file", :diff => diff, :index => i - - elsif file.image? - .diff_file_content_image{:class => image_diff_class(diff)} - %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} + - if file.respond_to?('text?') && file.respond_to?('image?') + - if file.text? + = render "commits/text_file", :diff => diff, :index => i + - elsif file.image? + .diff_file_content_image{:class => image_diff_class(diff)} + %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - else %p.nothing_here_message No preview for this file type -- GitLab From fab427348c376f6771b92b154d49c0f145644a08 Mon Sep 17 00:00:00 2001 From: Florian Unglaub Date: Tue, 3 Jul 2012 08:48:42 +0200 Subject: [PATCH 2/2] Nicer syntax for diff conditionals --- app/views/commits/_diffs.html.haml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/commits/_diffs.html.haml b/app/views/commits/_diffs.html.haml index 5c7d723e631..adedc93dcad 100644 --- a/app/views/commits/_diffs.html.haml +++ b/app/views/commits/_diffs.html.haml @@ -29,11 +29,10 @@ %span{:id => "#{diff.new_path}"}= diff.new_path %br/ .diff_file_content - - if file.respond_to?('text?') && file.respond_to?('image?') - - if file.text? - = render "commits/text_file", :diff => diff, :index => i - - elsif file.image? - .diff_file_content_image{:class => image_diff_class(diff)} - %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} + - if file.respond_to?('text?') && file.text? + = render "commits/text_file", :diff => diff, :index => i + - elsif file.respond_to?('image?') && file.image? + .diff_file_content_image{:class => image_diff_class(diff)} + %img{:src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - else %p.nothing_here_message No preview for this file type -- GitLab