_tree_file.html.haml 1.26 KB
Newer Older
gitlabhq's avatar
gitlabhq committed
1
:css
gitlabhq's avatar
gitlabhq committed
2 3
.view_file
  .view_file_header
4
    .row
5
      .span1.file_icon= image_tag(file.image? ? "file_img.png" : "file_txt.png")
6
      .span2.mode_text= file.mode
randx's avatar
randx committed
7 8
      .span5.file_name= name
      .span3.right
9 10
        = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "right", :target => "_blank"
        = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "right", :style => "margin-right:10px;"
gitlabhq's avatar
gitlabhq committed
11
  - if file.text?
12 13 14
    - if name =~ /\.(md|markdown)$/i
      #tree-readme-holder
        .readme
15
          = preserve do
16 17 18 19 20 21 22 23 24 25
            = markdown(file.data)
    - else
      .view_file_content
        - unless file.empty?
          %div{:class => current_user.dark_scheme ? "black" : "white"}
            = preserve do
              = raw file.colorize(options: { linenos: 'True'})
        - else
          %h3
            %center Empty file
gitlabhq's avatar
gitlabhq committed
26
  - elsif file.image?
gitlabhq's avatar
gitlabhq committed
27
    .view_file_content_image
gitlabhq's avatar
gitlabhq committed
28
      %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"}
gitlabhq's avatar
gitlabhq committed
29
  - else
30
    %center
31
      = link_to blob_project_ref_path(@project, @ref, :path => params[:path]) do 
32 33 34 35 36
        %div
          %br
          = image_tag "download.png", :width => 64
          %h3 
            Download (#{file.mb_size})