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,11 +6,13 @@ | ||
| 6 | - tree.breadcrumbs(6) do |link| | 6 | - tree.breadcrumbs(6) do |link| |
| 7 | \/ | 7 | \/ |
| 8 | %li= link | 8 | %li= link |
| 9 | + | ||
| 9 | .clear | 10 | .clear |
| 10 | %div.tree_progress | 11 | %div.tree_progress |
| 12 | + | ||
| 11 | %div#tree-content-holder.tree-content-holder | 13 | %div#tree-content-holder.tree-content-holder |
| 12 | - if tree.is_blob? | 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 | - else | 16 | - else |
| 15 | - contents = tree.contents | 17 | - contents = tree.contents |
| 16 | %table#tree-slider{class: "table_#{@hex_path} tree-table" } | 18 | %table#tree-slider{class: "table_#{@hex_path} tree-table" } |
app/views/tree/_tree_file.html.haml
| @@ -2,32 +2,32 @@ | @@ -2,32 +2,32 @@ | ||
| 2 | .file_title | 2 | .file_title |
| 3 | %i.icon-file | 3 | %i.icon-file |
| 4 | %span.file_name | 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 | %span.options | 7 | %span.options |
| 8 | = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank" | 8 | = link_to "raw", project_blob_path(@project, @id), class: "btn very_small", target: "_blank" |
| 9 | = link_to "history", project_commits_path(@project, @id), class: "btn very_small" | 9 | = link_to "history", project_commits_path(@project, @id), class: "btn very_small" |
| 10 | = link_to "blame", project_blame_path(@project, @id), class: "btn very_small" | 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 | .file_content.wiki | 13 | .file_content.wiki |
| 14 | = preserve do | 14 | = preserve do |
| 15 | - = markdown(file.data) | ||
| 16 | - - elsif markup?(name) | 15 | + = markdown(tree_file.data) |
| 16 | + - elsif markup?(tree_file.name) | ||
| 17 | .file_content.wiki | 17 | .file_content.wiki |
| 18 | - = raw GitHub::Markup.render(name, file.data) | 18 | + = raw GitHub::Markup.render(tree_file.name, tree_file.data) |
| 19 | - else | 19 | - else |
| 20 | .file_content.code | 20 | .file_content.code |
| 21 | - - unless file.empty? | 21 | + - unless tree_file.empty? |
| 22 | %div{class: current_user.dark_scheme ? "black" : "white"} | 22 | %div{class: current_user.dark_scheme ? "black" : "white"} |
| 23 | = preserve do | 23 | = preserve do |
| 24 | - = raw file.colorize(options: { linenos: 'True'}) | 24 | + = raw tree_file.colorize(options: { linenos: 'True'}) |
| 25 | - else | 25 | - else |
| 26 | %h4.nothing_here_message Empty file | 26 | %h4.nothing_here_message Empty file |
| 27 | 27 | ||
| 28 | - - elsif file.image? | 28 | + - elsif tree_file.image? |
| 29 | .file_content.image_file | 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 | - else | 32 | - else |
| 33 | .file_content.blob_file | 33 | .file_content.blob_file |
| @@ -37,4 +37,4 @@ | @@ -37,4 +37,4 @@ | ||
| 37 | %br | 37 | %br |
| 38 | = image_tag "download.png", width: 64 | 38 | = image_tag "download.png", width: 64 |
| 39 | %h3 | 39 | %h3 |
| 40 | - Download (#{file.mb_size}) | 40 | + Download (#{tree_file.mb_size}) |