Commit ed3f3a0d4ded937b8c9864b006c15ce8148f35c1

Authored by Dmitriy Zaporozhets
1 parent 0712e785

Download link for binary

app/assets/images/download.png 0 → 100644

3.55 KB

app/decorators/tree_decorator.rb
@@ -32,4 +32,13 @@ class TreeDecorator < ApplicationDecorator @@ -32,4 +32,13 @@ class TreeDecorator < ApplicationDecorator
32 def history_path 32 def history_path
33 h.project_commits_path(project, :path => path, :ref => ref) 33 h.project_commits_path(project, :path => path, :ref => ref)
34 end 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 end 44 end
app/views/projects/_form.html.haml
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 %td= f.label :default_branch, "Default Branch" 34 %td= f.label :default_branch, "Default Branch"
35 %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;") 35 %td= f.select(:default_branch, @project.heads.map(&:name), {}, :style => "width:300px;")
36 36
37 - %tr 37 + -#%tr
38 %td= f.label :tag_list 38 %td= f.label :tag_list
39 %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field 39 %td= f.text_area :tag_list, :placeholder => "project tags", :style => "height:50px", :id => :tag_field
40 %tr 40 %tr
app/views/refs/_tree_file.html.haml
@@ -20,6 +20,10 @@ @@ -20,6 +20,10 @@
20 .view_file_content_image 20 .view_file_content_image
21 %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} 21 %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
22 - else 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})