_file.html.haml 2.18 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 6
        = icon('archive fw')
        %strong
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 14 15 16 17 18 19 20 21 22 23
      = 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)
          %strong.filename.old
            = old_path
          →
          %strong.filename.new
            = new_path
        - else
          %strong
            = diff_file.new_path
          - if diff_file.deleted_file
            deleted
24

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

Douwe Maan's avatar
Douwe Maan committed
29
      .file-actions.hidden-xs
30
        - if blob_text_viewable?(blob)
Douwe Maan's avatar
Douwe Maan committed
31 32 33
          = 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
34

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

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

42
  .diff-content.diff-wrap-lines
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
43 44
    -# Skipp all non non-supported blobs
    - return unless blob.respond_to?('text?')
45 46 47
    - if diff_file.too_large?
      .nothing-here-block
        This diff could not be displayed because it is too large.
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
48
    - else
49 50 51 52 53 54 55 56 57 58
      - if blob_text_viewable?(blob)
        - if diff_view == 'parallel'
          = 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?
        - 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
      - else
        .nothing-here-block No preview for this file type