Commit ed3f3a0d4ded937b8c9864b006c15ce8148f35c1
1 parent
0712e785
Exists in
master
and in
4 other branches
Download link for binary
Showing
4 changed files
with
17 additions
and
4 deletions
Show diff stats
3.55 KB
app/decorators/tree_decorator.rb
| ... | ... | @@ -32,4 +32,13 @@ class TreeDecorator < ApplicationDecorator |
| 32 | 32 | def history_path |
| 33 | 33 | h.project_commits_path(project, :path => path, :ref => ref) |
| 34 | 34 | end |
| 35 | + | |
| 36 | + def mb_size | |
| 37 | + size = (tree.size / 1024) | |
| 38 | + if size < 1024 | |
| 39 | + "#{size} KB" | |
| 40 | + else | |
| 41 | + "#{size/1024} MB" | |
| 42 | + end | |
| 43 | + end | |
| 35 | 44 | end | ... | ... |
app/views/projects/_form.html.haml
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | %td= f.label :default_branch, "Default Branch" |
| 35 | 35 | %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;") |
| 36 | 36 | |
| 37 | - %tr | |
| 37 | + -#%tr | |
| 38 | 38 | %td= f.label :tag_list |
| 39 | 39 | %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field |
| 40 | 40 | %tr | ... | ... |
app/views/refs/_tree_file.html.haml
| ... | ... | @@ -20,6 +20,10 @@ |
| 20 | 20 | .view_file_content_image |
| 21 | 21 | %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} |
| 22 | 22 | - else |
| 23 | - %p | |
| 24 | - %center No preview for this file type | |
| 25 | - | |
| 23 | + %center | |
| 24 | + = link_to blob_project_ref_path(@project, @ref, :path => params[:path] ) do | |
| 25 | + %div | |
| 26 | + %br | |
| 27 | + = image_tag "download.png", :width => 64 | |
| 28 | + %h3 | |
| 29 | + Download (#{file.mb_size}) | ... | ... |