BigW Consortium Gitlab

diff.html.haml 1.66 KB
Newer Older
skv committed
1
- if @lines.present?
2
  - line_class = diff_view == :inline ? '' : diff_view
skv committed
3
  - if @form.unfold? && @form.since != 1 && !@form.bottom?
4 5
    %tr.line_holder{ class: line_class }
      = diff_match_line @form.since, @form.since, text: @match_line, view: diff_view
skv committed
6 7

  - @lines.each_with_index do |line, index|
8 9 10 11
    - line_number_new = index + @form.since
    - line_number_old = line_number_new - @form.offset
    - line[0, 0] = ' ' * @form.indent
    %tr.line_holder.diff-expanded{ id: line_number_old, class: line_class }
12 13
      - case diff_view
      - when :inline
14 15 16 17 18
        %td.old_line.diff-line-num{ data: { linenumber: line_number_old } }
          %a{ href: "#", data: { linenumber: line_number_old }, disabled: true }
        %td.new_line.diff-line-num{ data: { linenumber: line_number_new } }
          %a{ href: "#", data: { linenumber: line_number_new }, disabled: true }
        %td.line_content.noteable_line{ class: line_class }= line
19
      - when :parallel
20 21 22 23 24 25
        %td.old_line.diff-line-num{ data: { linenumber: line_number_old } }
          %a{ href: "##{line_number_old}", data: { linenumber: line_number_old }, disabled: true }
        %td.line_content.noteable_line.left-side{ class: line_class }= line
        %td.new_line.diff-line-num{ data: { linenumber: line_number_new } }
          %a{ href: "##{line_number_new}", data: { linenumber: line_number_new }, disabled: true }
        %td.line_content.noteable_line.right-side{ class: line_class }= line
skv committed
26

27
  - if @form.unfold? && @form.bottom? && @form.to < @blob.lines.size
28
    %tr.line_holder{ id: @form.to, class: line_class }
29
      = diff_match_line @form.to - @form.offset, @form.to, text: @match_line, view: diff_view, bottom: true