_file.html.haml 2.36 KB
Newer Older
Douwe Maan's avatar
Douwe Maan committed
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
        = icon('archive fw')
Annabel Dunstone's avatar
Annabel Dunstone committed
6
        %span
7
          = submodule_link(blob, @commit.id, project.repository)
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
8
    - else
Douwe Maan's avatar
Douwe Maan committed
9
      = blob_icon blob.mode, blob.name
10

11 12 13
      = link_to "#diff-#{i}" do
        - if diff_file.renamed_file
          - old_path, new_path = mark_inline_diffs(diff_file.old_path, diff_file.new_path)
14
          = old_path
15
          →
16
          = new_path
17
        - else
Annabel Dunstone's avatar
Annabel Dunstone committed
18
          %span
19 20 21
            = diff_file.new_path
          - if diff_file.deleted_file
            deleted
22

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

Douwe Maan's avatar
Douwe Maan committed
27
      .file-actions.hidden-xs
28
        - if blob_text_viewable?(blob)
Annabel Dunstone's avatar
Annabel Dunstone committed
29
          = link_to '#', class: 'js-toggle-diff-comments btn active has-tooltip btn-file-option', title: "Toggle comments for this file" do
30
            = icon('comment')
Douwe Maan's avatar
Douwe Maan committed
31
          \
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
32

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

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

40
  .diff-content.diff-wrap-lines
41
    - # Skip all non non-supported blobs
42
    - return unless blob.respond_to?(:text?)
43
    - if diff_file.too_large?
44 45 46 47 48 49
      .nothing-here-block This diff could not be displayed because it is too large.
    - elsif blob_text_viewable?(blob) && !project.repository.diffable?(blob)
      .nothing-here-block This diff was suppressed by a .gitattributes entry.
    - elsif blob_text_viewable?(blob)
      - if diff_view == 'parallel'
        = render "projects/diffs/parallel_view", diff_file: diff_file, project: project, blob: blob, index: i
50
      - else
51
        = render "projects/diffs/text_file", diff_file: diff_file, index: i
52 53
    - elsif blob.only_display_raw?
      .nothing-here-block This file is too large to display.
54 55 56 57 58
    - elsif blob.image?
      - old_file = project.repository.prev_blob_for_diff(diff_commit, diff_file)
      = render "projects/diffs/image", diff_file: diff_file, old_file: old_file, file: blob, index: i, diff_refs: diff_refs
    - else
      .nothing-here-block No preview for this file type