diff --git a/app/assets/images/download.png b/app/assets/images/download.png new file mode 100644 index 0000000000000000000000000000000000000000..50f672c548008cbadd529ff71d1ac79ff583a3c5 Binary files /dev/null and b/app/assets/images/download.png differ diff --git a/app/decorators/tree_decorator.rb b/app/decorators/tree_decorator.rb index 11af9724c0f2a09ade6a4add8ef88c30cc2e6857..c2a640f62029edb5e9965052ea5b2013779504e8 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 0f4f108b9bb409c33c31bb22b652c05b289b588d..254563bda81e707e94ab5dfb4a1684e701d214e1 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 51264e38c59002faad6f8e909355bf230a2df9b4..fdc2469d971bbcf786944eb308d8a27444ea83f2 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})