diff options
author | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-15 08:42:24 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com> | 2011-12-15 08:42:24 +0200 |
commit | ed3f3a0d4ded937b8c9864b006c15ce8148f35c1 (patch) | |
tree | 281900d16f779ab146ff6a3d231f78426efdea56 | |
parent | 0712e78597e5954ea61def4c0a6836a3d5b5d275 (diff) | |
download | gitlab-ce-ed3f3a0d4ded937b8c9864b006c15ce8148f35c1.tar.gz |
Download link for binary
-rw-r--r-- | app/assets/images/download.png | bin | 0 -> 3637 bytes | |||
-rw-r--r-- | app/decorators/tree_decorator.rb | 9 | ||||
-rw-r--r-- | app/views/projects/_form.html.haml | 2 | ||||
-rw-r--r-- | app/views/refs/_tree_file.html.haml | 10 |
4 files changed, 17 insertions, 4 deletions
diff --git a/app/assets/images/download.png b/app/assets/images/download.png Binary files differnew file mode 100644 index 00000000000..50f672c5480 --- /dev/null +++ b/app/assets/images/download.png diff --git a/app/decorators/tree_decorator.rb b/app/decorators/tree_decorator.rb index 11af9724c0f..c2a640f6202 100644 --- a/app/decorators/tree_decorator.rb +++ b/app/decorators/tree_decorator.rb @@ -32,4 +32,13 @@ class TreeDecorator < ApplicationDecorator def history_path h.project_commits_path(project, :path => path, :ref => ref) end + + def mb_size + size = (tree.size / 1024) + if size < 1024 + "#{size} KB" + else + "#{size/1024} MB" + end + end end diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 0f4f108b9bb..254563bda81 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -34,7 +34,7 @@ %td= f.label :default_branch, "Default Branch" %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;") - %tr + -#%tr %td= f.label :tag_list %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field %tr diff --git a/app/views/refs/_tree_file.html.haml b/app/views/refs/_tree_file.html.haml index 51264e38c59..fdc2469d971 100644 --- a/app/views/refs/_tree_file.html.haml +++ b/app/views/refs/_tree_file.html.haml @@ -20,6 +20,10 @@ .view_file_content_image %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} - else - %p - %center No preview for this file type - + %center + = link_to blob_project_ref_path(@project, @ref, :path => params[:path] ) do + %div + %br + = image_tag "download.png", :width => 64 + %h3 + Download (#{file.mb_size}) |