[#369] pull requests: show images
This commit is contained in:
parent
30fab8f2be
commit
ec285dae39
|
@ -65,3 +65,21 @@ table.table.diff.inline
|
|||
|
||||
.line-comment, #new_inline_comment
|
||||
max-width: 700px
|
||||
|
||||
td.diff-image
|
||||
text-align: center
|
||||
|
||||
span.diff-image
|
||||
text-align: center
|
||||
margin: 0
|
||||
padding: 0
|
||||
|
||||
img
|
||||
margin-top: 5px
|
||||
|
||||
div.file div.top
|
||||
height: 28px
|
||||
background: #ededed
|
||||
|
||||
.pull-left, .pull-right
|
||||
margin: 6px 10px 0px 10px
|
||||
|
|
|
@ -6,5 +6,15 @@
|
|||
- if @pull.from_project.present?
|
||||
.pull-right= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@pull.from_project, commit_id, pull_diff.b_path)
|
||||
.clearfix
|
||||
-if pull_diff.diff.present? && !(@pull.repo.tree(commit_id) / pull_diff.b_path).binary?
|
||||
.diff_data== render_diff(pull_diff, diff_counter: pull_diff_counter, comments: @comments)
|
||||
|
||||
-if pull_diff.diff.present?
|
||||
.diff_data
|
||||
- blob = @pull.repo.tree(commit_id) / pull_diff.b_path
|
||||
- if blob.render_as == :image
|
||||
table.table.diff.inline.table-bordered[ cellspacing = 0 cellpadding = 0 ]
|
||||
tr
|
||||
td.diff-image
|
||||
span.diff-image
|
||||
img[ src = "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"
|
||||
style = 'max-width: 600px;' ]
|
||||
== render_diff(pull_diff, diff_counter: pull_diff_counter, comments: @comments) unless blob.binary?
|
||||
|
|
Loading…
Reference in New Issue