Commit c89d9e74 authored by Mike Greiling's avatar Mike Greiling

only show diff unfolding link if there are more lines to show

parent d6fea1e8
...@@ -25,6 +25,6 @@ ...@@ -25,6 +25,6 @@
= link_to raw(line_new), "##{line_new}" = link_to raw(line_new), "##{line_new}"
= line_content = line_content
- if @form.unfold? && @form.bottom? && @form.to < @blob.loc - if @form.unfold? && @form.bottom? && @form.to < @blob.lines.size
%tr.line_holder{ id: @form.to, class: line_class } %tr.line_holder{ id: @form.to, class: line_class }
= diff_match_line @form.to - @form.offset, @form.to, text: @match_line, view: diff_view, bottom: true = diff_match_line @form.to - @form.offset, @form.to, text: @match_line, view: diff_view, bottom: true
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
%a.click-to-expand %a.click-to-expand
Click to expand it. Click to expand it.
- elsif diff_file.diff_lines.length > 0 - elsif diff_file.diff_lines.length > 0
- total_lines = blob.lines.last.chomp == '' ? blob.lines.size - 1 : blob.lines.size
- if diff_view == :parallel - if diff_view == :parallel
= render "projects/diffs/parallel_view", diff_file: diff_file, project: project, blob: blob = render "projects/diffs/parallel_view", diff_file: diff_file, total_lines: total_lines
- else - else
= render "projects/diffs/text_file", diff_file: diff_file = render "projects/diffs/text_file", diff_file: diff_file, total_lines: total_lines
- else - else
- if diff_file.mode_changed? - if diff_file.mode_changed?
.nothing-here-block File mode changed .nothing-here-block File mode changed
......
...@@ -45,5 +45,6 @@ ...@@ -45,5 +45,6 @@
= render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right = render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right
- if !diff_file.new_file && diff_file.diff_lines.any? - if !diff_file.new_file && diff_file.diff_lines.any?
- last_line = diff_file.diff_lines.last - last_line = diff_file.diff_lines.last
- if last_line.new_pos < total_lines
%tr.line_holder.parallel %tr.line_holder.parallel
= diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
- if !diff_file.new_file && diff_file.highlighted_diff_lines.any? - if !diff_file.new_file && diff_file.highlighted_diff_lines.any?
- last_line = diff_file.highlighted_diff_lines.last - last_line = diff_file.highlighted_diff_lines.last
- if last_line.new_pos < total_lines
%tr.line_holder %tr.line_holder
= diff_match_line last_line.old_pos, last_line.new_pos, bottom: true = diff_match_line last_line.old_pos, last_line.new_pos, bottom: true
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment