_file.html.haml 1.86 KB
Newer Older
1 2
.diff-file.file-holder{id: "diff-#{i}", data: diff_file_html_data(project, diff_commit, diff_file)}
  .file-title{id: "file-path-#{hexdigest(diff_file.file_path)}"}
3
    - if diff_file.diff.submodule?
4
      %span
5 6
        = icon('archive fw')
        %strong
7
          = submodule_link(blob, @commit.id, project.repository)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
8
    - else
9 10 11 12
      = blob_icon blob.mode, blob.name
      = link_to "#diff-#{i}" do
        %strong
          = diff_file.new_path
13

14 15 16 17 18 19
      - if diff_file.deleted_file
        deleted
      - elsif diff_file.renamed_file
        renamed from
        %strong
          = diff_file.old_path
20

21 22 23
      - if diff_file.mode_changed?
        %small
          = "#{diff_file.diff.a_mode}#{diff_file.diff.b_mode}"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
24

25
      .file-actions.hidden-xs
26
        - if blob_text_viewable?(blob)
27 28 29
          = link_to '#', class: 'js-toggle-diff-comments btn active has_tooltip', title: "Toggle comments for this file" do
            = icon('comments')
          \
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
30

31
        - if editable_diff?(diff_file)
32 33
          = edit_blob_link(@merge_request.source_project,
              @merge_request.source_branch, diff_file.new_path,
34
              from_merge_request_id: @merge_request.id)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
35

36
        = view_file_btn(diff_commit.id, diff_file, project)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
37

38
  .diff-content.diff-wrap-lines
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
39 40
    -# Skipp all non non-supported blobs
    - return unless blob.respond_to?('text?')
41
    - if blob_text_viewable?(blob)
42
      - if diff_view == 'parallel'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
43 44 45 46
        = render "projects/diffs/parallel_view", diff_file: diff_file, project: project, blob: blob, index: i
      - else
        = render "projects/diffs/text_file", diff_file: diff_file, index: i
    - elsif blob.image?
47
      - old_file = project.repository.prev_blob_for_diff(diff_commit, diff_file)
48
      = render "projects/diffs/image", diff_file: diff_file, old_file: old_file, file: blob, index: i
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
49 50
    - else
      .nothing-here-block No preview for this file type