diff options
Diffstat (limited to 'app/views/projects/diffs')
-rw-r--r-- | app/views/projects/diffs/_diffs.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/diffs/_file.html.haml | 1 | ||||
-rw-r--r-- | app/views/projects/diffs/_line.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/diffs/_parallel_view.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/diffs/_stats.html.haml | 1 | ||||
-rw-r--r-- | app/views/projects/diffs/_text_file.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/diffs/_warning.html.haml | 13 |
7 files changed, 13 insertions, 17 deletions
diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml index bb2682bb7c0..6f4ffecd5e0 100644 --- a/app/views/projects/diffs/_diffs.html.haml +++ b/app/views/projects/diffs/_diffs.html.haml @@ -5,7 +5,8 @@ - load_diff_files_async = Feature.enabled?(:async_commit_diff_files, @project) && diff_page_context == "is-commit" - paginate_diffs = local_assigns.fetch(:paginate_diffs, false) && !load_diff_files_async - paginate_diffs_per_page = local_assigns.fetch(:paginate_diffs_per_page, nil) -- diff_files = conditionally_paginate_diff_files(diffs, paginate: paginate_diffs, per: paginate_diffs_per_page) +- page = local_assigns.fetch(:page, nil) +- diff_files = conditionally_paginate_diff_files(diffs, paginate: paginate_diffs, page: page, per: paginate_diffs_per_page) .content-block.oneline-block.files-changed.diff-files-changed.js-diff-files-changed .files-changed-inner @@ -24,10 +25,10 @@ .btn-group.gl-ml-3 = inline_diff_btn = parallel_diff_btn - = render 'projects/diffs/stats', diff_files: diff_files + = render Diffs::StatsComponent.new(diff_files: diff_files) - if render_overflow_warning?(diffs) - = render 'projects/diffs/warning', diff_files: diffs + = render Diffs::OverflowWarningComponent.new(diffs: diffs, diff_files: diff_files, project: @project, commit: @commit, merge_request: @merge_request) .files{ data: { can_create_note: can_create_note } } - if load_diff_files_async diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index 0638481d968..64bd1bf32f0 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -15,6 +15,7 @@ - unless diff_file.submodule? .file-actions.gl-display-none.gl-sm-display-flex + #js-diff-stats{ data: diff_file_stats_data(diff_file) } - if diff_file.blob&.readable_text? %span.has-tooltip{ title: _("Toggle comments for this file") } = link_to '#', class: 'js-toggle-diff-comments btn gl-button btn-default btn-icon selected', disabled: @diff_notes_disabled do diff --git a/app/views/projects/diffs/_line.html.haml b/app/views/projects/diffs/_line.html.haml index a5d3328b439..dd5114e3cec 100644 --- a/app/views/projects/diffs/_line.html.haml +++ b/app/views/projects/diffs/_line.html.haml @@ -10,6 +10,8 @@ - case line.type - when 'match' = diff_match_line line.old_pos, line.new_pos, text: line.text + - when 'old-nomappinginraw', 'new-nomappinginraw', 'unchanged-nomappinginraw' + = diff_nomappinginraw_line line, %w[old_line diff-line-num], %w[new_line diff-line-num], %w[line_content] - when 'old-nonewline', 'new-nonewline' %td.old_line.diff-line-num %td.new_line.diff-line-num diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index ebe3aad064a..03fe3e6edf5 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -11,6 +11,8 @@ - case left.type - when 'match' = diff_match_line left.old_pos, nil, text: left.text, view: :parallel + - when 'old-nomappinginraw', 'new-nomappinginraw', 'unchanged-nomappinginraw' + = diff_nomappinginraw_line left, %w[old_line diff-line-num], nil, %w[line_content parallel left-side] - when 'old-nonewline', 'new-nonewline' %td.old_line.diff-line-num %td.line_content.match.left-side= left.text @@ -29,6 +31,8 @@ - case right.type - when 'match' = diff_match_line nil, right.new_pos, text: left.text, view: :parallel + - when 'old-nomappinginraw', 'new-nomappinginraw', 'unchanged-nomappinginraw' + = diff_nomappinginraw_line right, %w[new_line diff-line-num], nil, %w[line_content parallel right-side] - when 'old-nonewline', 'new-nonewline' %td.new_line.diff-line-num %td.line_content.match.right-side= right.text diff --git a/app/views/projects/diffs/_stats.html.haml b/app/views/projects/diffs/_stats.html.haml deleted file mode 100644 index fe9658a440a..00000000000 --- a/app/views/projects/diffs/_stats.html.haml +++ /dev/null @@ -1 +0,0 @@ -.js-diff-stats-dropdown{ data: { changed: diff_files.size, added: diff_files.sum(&:added_lines), deleted: diff_files.sum(&:removed_lines), files: diff_files_data(diff_files) } } diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index 6e7e0244721..2cd215c5518 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -12,6 +12,8 @@ - case line.type - when 'match' = diff_match_line line.old_pos, line.new_pos, text: line.text + - when 'old-nomappinginraw', 'new-nomappinginraw', 'unchanged-nomappinginraw' + = diff_nomappinginraw_line line, %w[old_line diff-line-num], %w[new_line diff-line-num], %w[line_content] - when 'old-nonewline', 'new-nonewline' %td.old_line.diff-line-num %td.new_line.diff-line-num diff --git a/app/views/projects/diffs/_warning.html.haml b/app/views/projects/diffs/_warning.html.haml deleted file mode 100644 index 3d31773694f..00000000000 --- a/app/views/projects/diffs/_warning.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -= render 'shared/global_alert', - title: _('Too many changes to show.'), - variant: :warning, - alert_class: 'gl-mb-5' do - .gl-alert-body - = html_escape(_("To preserve performance only %{strong_open}%{display_size} of %{real_size}%{strong_close} files are displayed.")) % { display_size: diff_files.size, real_size: diff_files.real_size, strong_open: '<strong>'.html_safe, strong_close: '</strong>'.html_safe } - .gl-alert-actions - - if current_controller?(:commit) - = link_to _("Plain diff"), project_commit_path(@project, @commit, format: :diff), class: "btn gl-alert-action btn-default gl-button btn-default-secondary" - = link_to _("Email patch"), project_commit_path(@project, @commit, format: :patch), class: "btn gl-alert-action btn-default gl-button btn-default-secondary" - - elsif current_controller?('projects/merge_requests/diffs') && @merge_request&.persisted? - = link_to _("Plain diff"), merge_request_path(@merge_request, format: :diff), class: "btn gl-alert-action btn-default gl-button btn-default-secondary" - = link_to _("Email patch"), merge_request_path(@merge_request, format: :patch), class: "btn gl-alert-action btn-default gl-button btn-default-secondary" |