Commit 2f05ab149110705cf4947de3eff877391c94f9cb

Authored by Riyad Preukschas
1 parent e84d90c1

Rename tree/tree_file partial to tree/blob

app/views/tree/_blob.html.haml 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +.file_holder
  2 + .file_title
  3 + %i.icon-file
  4 + %span.file_name
  5 + = blob.name.force_encoding('utf-8')
  6 + %small #{blob.mode}
  7 + %span.options
  8 + .btn-group.tree-btn-group
  9 + = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank"
  10 + = link_to "history", project_commits_path(@project, @id), class: "btn very_small"
  11 + = link_to "blame", project_blame_path(@project, @id), class: "btn very_small"
  12 + = link_to "edit", edit_project_tree_path(@project, @id), class: "btn very_small"
  13 + - if blob.text?
  14 + - if gitlab_markdown?(blob.name)
  15 + .file_content.wiki
  16 + = preserve do
  17 + = markdown(blob.data)
  18 + - elsif markup?(blob.name)
  19 + .file_content.wiki
  20 + = raw GitHub::Markup.render(blob.name, blob.data)
  21 + - else
  22 + .file_content.code
  23 + - unless blob.empty?
  24 + %div{class: current_user.dark_scheme ? "black" : "white"}
  25 + = preserve do
  26 + = raw blob.colorize(options: { linenos: 'True'})
  27 + - else
  28 + %h4.nothing_here_message Empty file
  29 +
  30 + - elsif blob.image?
  31 + .file_content.image_file
  32 + %img{ src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"}
  33 +
  34 + - else
  35 + .file_content.blob_file
  36 + %center
  37 + = link_to project_blob_path(@project, @id) do
  38 + %div.padded
  39 + %br
  40 + = image_tag "download.png", width: 64
  41 + %h3
  42 + Download (#{blob.mb_size})
... ...
app/views/tree/_tree.html.haml
... ... @@ -12,7 +12,7 @@
12 12  
13 13 %div#tree-content-holder.tree-content-holder
14 14 - if tree.is_blob?
15   - = render partial: "tree/tree_file", object: tree
  15 + = render partial: "tree/blob", object: tree
16 16 - else
17 17 %table#tree-slider{class: "table_#{@hex_path} tree-table" }
18 18 %thead
... ...
app/views/tree/_tree_file.html.haml
... ... @@ -1,42 +0,0 @@
1   -.file_holder
2   - .file_title
3   - %i.icon-file
4   - %span.file_name
5   - = tree_file.name.force_encoding('utf-8')
6   - %small #{tree_file.mode}
7   - %span.options
8   - .btn-group.tree-btn-group
9   - = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank"
10   - = link_to "history", project_commits_path(@project, @id), class: "btn very_small"
11   - = link_to "blame", project_blame_path(@project, @id), class: "btn very_small"
12   - = link_to "edit", edit_project_tree_path(@project, @id), class: "btn very_small"
13   - - if tree_file.text?
14   - - if gitlab_markdown?(tree_file.name)
15   - .file_content.wiki
16   - = preserve do
17   - = markdown(tree_file.data)
18   - - elsif markup?(tree_file.name)
19   - .file_content.wiki
20   - = raw GitHub::Markup.render(tree_file.name, tree_file.data)
21   - - else
22   - .file_content.code
23   - - unless tree_file.empty?
24   - %div{class: current_user.dark_scheme ? "black" : "white"}
25   - = preserve do
26   - = raw tree_file.colorize(options: { linenos: 'True'})
27   - - else
28   - %h4.nothing_here_message Empty file
29   -
30   - - elsif tree_file.image?
31   - .file_content.image_file
32   - %img{ src: "data:#{tree_file.mime_type};base64,#{Base64.encode64(tree_file.data)}"}
33   -
34   - - else
35   - .file_content.blob_file
36   - %center
37   - = link_to project_blob_path(@project, @id) do
38   - %div.padded
39   - %br
40   - = image_tag "download.png", width: 64
41   - %h3
42   - Download (#{tree_file.mb_size})