Commit d060856044655ac76101a8ded51507479b4bc34a

Authored by Riyad Preukschas
1 parent 1f4d8eac

Extract out tree/blob/* partials

app/views/tree/_blob.html.haml
@@ -6,32 +6,8 @@ @@ -6,32 +6,8 @@
6 %small #{blob.mode} 6 %small #{blob.mode}
7 %span.options= render "tree/blob_actions" 7 %span.options= render "tree/blob_actions"
8 - if blob.text? 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 - elsif blob.image? 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 - else 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
app/views/tree/blob/_download.html.haml 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +.file_content.blob_file
  2 + %center
  3 + = link_to project_blob_path(@project, @id) do
  4 + %div.padded
  5 + %br
  6 + = image_tag "download.png", width: 64
  7 + %h3
  8 + Download (#{blob.mb_size})
app/views/tree/blob/_image.html.haml 0 → 100644
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +.file_content.image_file
  2 + %img{ src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"}
app/views/tree/blob/_text.html.haml 0 → 100644
@@ -0,0 +1,15 @@ @@ -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