Commit 96b4acf5e7e1d73e06b84efd31f1bc433bd79a1c
1 parent
b5328879
Exists in
master
and in
4 other branches
Remove locals from tree/tree_file and just use "object" instead
Showing
2 changed files
with
15 additions
and
13 deletions
Show diff stats
app/views/tree/_tree.html.haml
| ... | ... | @@ -6,11 +6,13 @@ |
| 6 | 6 | - tree.breadcrumbs(6) do |link| |
| 7 | 7 | \/ |
| 8 | 8 | %li= link |
| 9 | + | |
| 9 | 10 | .clear |
| 10 | 11 | %div.tree_progress |
| 12 | + | |
| 11 | 13 | %div#tree-content-holder.tree-content-holder |
| 12 | 14 | - if tree.is_blob? |
| 13 | - = render partial: "tree/tree_file", locals: { name: tree.name, content: tree.data, file: tree } | |
| 15 | + = render partial: "tree/tree_file", object: tree | |
| 14 | 16 | - else |
| 15 | 17 | - contents = tree.contents |
| 16 | 18 | %table#tree-slider{class: "table_#{@hex_path} tree-table" } | ... | ... |
app/views/tree/_tree_file.html.haml
| ... | ... | @@ -2,32 +2,32 @@ |
| 2 | 2 | .file_title |
| 3 | 3 | %i.icon-file |
| 4 | 4 | %span.file_name |
| 5 | - = name.force_encoding('utf-8') | |
| 6 | - %small #{file.mode} | |
| 5 | + = tree_file.name.force_encoding('utf-8') | |
| 6 | + %small #{tree_file.mode} | |
| 7 | 7 | %span.options |
| 8 | 8 | = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank" |
| 9 | 9 | = link_to "history", project_commits_path(@project, @id), class: "btn very_small" |
| 10 | 10 | = link_to "blame", project_blame_path(@project, @id), class: "btn very_small" |
| 11 | - - if file.text? | |
| 12 | - - if gitlab_markdown?(name) | |
| 11 | + - if tree_file.text? | |
| 12 | + - if gitlab_markdown?(tree_file.name) | |
| 13 | 13 | .file_content.wiki |
| 14 | 14 | = preserve do |
| 15 | - = markdown(file.data) | |
| 16 | - - elsif markup?(name) | |
| 15 | + = markdown(tree_file.data) | |
| 16 | + - elsif markup?(tree_file.name) | |
| 17 | 17 | .file_content.wiki |
| 18 | - = raw GitHub::Markup.render(name, file.data) | |
| 18 | + = raw GitHub::Markup.render(tree_file.name, tree_file.data) | |
| 19 | 19 | - else |
| 20 | 20 | .file_content.code |
| 21 | - - unless file.empty? | |
| 21 | + - unless tree_file.empty? | |
| 22 | 22 | %div{class: current_user.dark_scheme ? "black" : "white"} |
| 23 | 23 | = preserve do |
| 24 | - = raw file.colorize(options: { linenos: 'True'}) | |
| 24 | + = raw tree_file.colorize(options: { linenos: 'True'}) | |
| 25 | 25 | - else |
| 26 | 26 | %h4.nothing_here_message Empty file |
| 27 | 27 | |
| 28 | - - elsif file.image? | |
| 28 | + - elsif tree_file.image? | |
| 29 | 29 | .file_content.image_file |
| 30 | - %img{ src: "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | |
| 30 | + %img{ src: "data:#{tree_file.mime_type};base64,#{Base64.encode64(tree_file.data)}"} | |
| 31 | 31 | |
| 32 | 32 | - else |
| 33 | 33 | .file_content.blob_file |
| ... | ... | @@ -37,4 +37,4 @@ |
| 37 | 37 | %br |
| 38 | 38 | = image_tag "download.png", width: 64 |
| 39 | 39 | %h3 |
| 40 | - Download (#{file.mb_size}) | |
| 40 | + Download (#{tree_file.mb_size}) | ... | ... |