BigW Consortium Gitlab

_diffs.html.haml 1.54 KB
Newer Older
Alfredo Sumaran committed
1
- show_whitespace_toggle = local_assigns.fetch(:show_whitespace_toggle, true)
2
- diff_files = diffs.diff_files
3
- if diff_view == :parallel
4 5
  - fluid_layout true

Annabel Dunstone committed
6
.content-block.oneline-block.files-changed
7
  .inline-parallel-buttons
8
    - if !expand_all_diffs? && diff_files.any? { |diff_file| diff_file.collapsed? }
9
      = link_to 'Expand all', url_for(params.merge(expand_all_diffs: 1, format: nil)), class: 'btn btn-default'
10 11
    - if show_whitespace_toggle
      - if current_controller?(:commit)
12
        = commit_diff_whitespace_link(diffs.project, @commit, class: 'hidden-xs')
Alfredo Sumaran committed
13
      - elsif current_controller?(:merge_requests)
14
        = diff_merge_request_whitespace_link(diffs.project, @merge_request, class: 'hidden-xs')
15
      - elsif current_controller?(:compare)
16
        = diff_compare_whitespace_link(diffs.project, params[:from], params[:to], class: 'hidden-xs')
17
    .btn-group
18 19
      = inline_diff_btn
      = parallel_diff_btn
20
  = render 'projects/diffs/stats', diff_files: diff_files
21

22 23
- if diff_files.overflow?
  = render 'projects/diffs/warning', diff_files: diff_files
24

25
.files{data: {can_create_note: (!@diff_notes_disabled && can?(current_user, :create_note, diffs.project))}}
26
  - diff_files.each_with_index do |diff_file, index|
27
    - diff_commit = commit_for_diff(diff_file)
28
    - blob = diff_file.blob(diff_commit)
29
    - next unless blob
30
    - blob.load_all_data!(diffs.project.repository) unless blob.only_display_raw?
31

Herminio Torres committed
32
    = render 'projects/diffs/file', index: index, project: diffs.project,
33
      diff_file: diff_file, diff_commit: diff_commit, blob: blob