2014-08-02 11:12:01 -04:00
|
|
|
- if @lines.present?
|
2016-07-21 14:44:12 -04:00
|
|
|
- line_class = diff_view == :inline ? '' : diff_view
|
2014-08-02 11:12:01 -04:00
|
|
|
- if @form.unfold? && @form.since != 1 && !@form.bottom?
|
2016-07-21 14:44:12 -04:00
|
|
|
%tr.line_holder{ class: line_class }
|
|
|
|
= diff_match_line @form.since, @form.since, text: @match_line, view: diff_view
|
2014-08-02 11:12:01 -04:00
|
|
|
|
|
|
|
- @lines.each_with_index do |line, index|
|
|
|
|
- line_new = index + @form.since
|
|
|
|
- line_old = line_new - @form.offset
|
2016-07-21 14:44:12 -04:00
|
|
|
- line_content = capture do
|
|
|
|
%td.line_content.noteable_line{ class: line_class }==#{' ' * @form.indent}#{line}
|
|
|
|
%tr.line_holder{ id: line_old, class: line_class }
|
|
|
|
- case diff_view
|
|
|
|
- when :inline
|
|
|
|
%td.old_line.diff-line-num{ data: { linenumber: line_old } }
|
2016-12-26 05:47:16 -05:00
|
|
|
%a{ href: "##{line_old}", data: { linenumber: line_old } }
|
2016-07-21 14:44:12 -04:00
|
|
|
%td.new_line.diff-line-num{ data: { linenumber: line_new } }
|
2016-12-26 05:47:16 -05:00
|
|
|
%a{ href: "##{line_new}", data: { linenumber: line_new } }
|
2016-07-21 14:44:12 -04:00
|
|
|
= line_content
|
|
|
|
- when :parallel
|
2016-12-26 05:47:16 -05:00
|
|
|
%td.old_line.diff-line-num{ data: { linenumber: line_old } }
|
2016-07-21 14:44:12 -04:00
|
|
|
= link_to raw(line_old), "##{line_old}"
|
|
|
|
= line_content
|
2016-12-26 05:47:16 -05:00
|
|
|
%td.new_line.diff-line-num{ data: { linenumber: line_new } }
|
2016-07-21 14:44:12 -04:00
|
|
|
= link_to raw(line_new), "##{line_new}"
|
|
|
|
= line_content
|
2014-08-02 11:12:01 -04:00
|
|
|
|
|
|
|
- if @form.unfold? && @form.bottom? && @form.to < @blob.loc
|
2016-07-21 14:44:12 -04:00
|
|
|
%tr.line_holder{ id: @form.to, class: line_class }
|
|
|
|
= diff_match_line @form.to, @form.to, text: @match_line, view: diff_view, bottom: true
|