show blob images in the commit

This commit is contained in:
Alexander Machehin 2014-10-08 18:15:28 +06:00
parent d11fe17937
commit 6660c930c8
1 changed files with 14 additions and 3 deletions

View File

@ -6,6 +6,17 @@
- if commit_diff.b_path.present?
.r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@project, commit_id, commit_diff.b_path)
.clear
-if commit_diff.diff.present? && !(@project.repo.tree(commit_id) / commit_diff.a_path).binary?
="a_path=#{commit_diff.a_path}; b_path=#{commit_diff.b_path}" if (@project.repo.tree(commit_id) / commit_diff.b_path).nil?
.diff_data=render_diff(commit_diff, diff_counter: commit_diff_counter, comments: @comments)
- if commit_diff.diff.present?
- blob = @project.repo.tree(commit_id) / commit_diff.a_path
- if blob.render_as == :image
%table.diff.inline{ cellspacing: 0, cellpadding: 0 }
%tr
%td.lines
%td.blob.diff-image
%span.diff-image
%img{ src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}",
style: 'max-width: 600px;' }
- else !blob.binary?
- if (@project.repo.tree(commit_id) / commit_diff.b_path).nil?
="a_path=#{commit_diff.a_path}; b_path=#{commit_diff.b_path}"
.diff_data=render_diff(commit_diff, diff_counter: commit_diff_counter, comments: @comments)