Commit d060856044655ac76101a8ded51507479b4bc34a
1 parent
1f4d8eac
Exists in
master
and in
4 other branches
Extract out tree/blob/* partials
Showing
4 changed files
with
28 additions
and
27 deletions
Show diff stats
app/views/tree/_blob.html.haml
| ... | ... | @@ -6,32 +6,8 @@ |
| 6 | 6 | %small #{blob.mode} |
| 7 | 7 | %span.options= render "tree/blob_actions" |
| 8 | 8 | - if blob.text? |
| 9 | - - if gitlab_markdown?(blob.name) | |
| 10 | - .file_content.wiki | |
| 11 | - = preserve do | |
| 12 | - = markdown(blob.data) | |
| 13 | - - elsif markup?(blob.name) | |
| 14 | - .file_content.wiki | |
| 15 | - = raw GitHub::Markup.render(blob.name, blob.data) | |
| 16 | - - else | |
| 17 | - .file_content.code | |
| 18 | - - unless blob.empty? | |
| 19 | - %div{class: current_user.dark_scheme ? "black" : "white"} | |
| 20 | - = preserve do | |
| 21 | - = raw blob.colorize(options: { linenos: 'True'}) | |
| 22 | - - else | |
| 23 | - %h4.nothing_here_message Empty file | |
| 24 | - | |
| 9 | + = render "tree/blob/text", blob: blob | |
| 25 | 10 | - elsif blob.image? |
| 26 | - .file_content.image_file | |
| 27 | - %img{ src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"} | |
| 28 | - | |
| 11 | + = render "tree/blob/image", blob: blob | |
| 29 | 12 | - else |
| 30 | - .file_content.blob_file | |
| 31 | - %center | |
| 32 | - = link_to project_blob_path(@project, @id) do | |
| 33 | - %div.padded | |
| 34 | - %br | |
| 35 | - = image_tag "download.png", width: 64 | |
| 36 | - %h3 | |
| 37 | - Download (#{blob.mb_size}) | |
| 13 | + = render "tree/blob/download", blob: blob | ... | ... |
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +- if gitlab_markdown?(blob.name) | |
| 2 | + .file_content.wiki | |
| 3 | + = preserve do | |
| 4 | + = markdown(blob.data) | |
| 5 | +- elsif markup?(blob.name) | |
| 6 | + .file_content.wiki | |
| 7 | + = raw GitHub::Markup.render(blob.name, blob.data) | |
| 8 | +- else | |
| 9 | + .file_content.code | |
| 10 | + - unless blob.empty? | |
| 11 | + %div{class: current_user.dark_scheme ? "black" : "white"} | |
| 12 | + = preserve do | |
| 13 | + = raw blob.colorize(options: { linenos: 'True'}) | |
| 14 | + - else | |
| 15 | + %h4.nothing_here_message Empty file | ... | ... |