diff options
Diffstat (limited to 'app/views/projects/commits/_diffs.html.haml')
-rw-r--r-- | app/views/projects/commits/_diffs.html.haml | 102 |
1 files changed, 12 insertions, 90 deletions
diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml index e062e9b8d54..64d6a2f09cf 100644 --- a/app/views/projects/commits/_diffs.html.haml +++ b/app/views/projects/commits/_diffs.html.haml @@ -1,47 +1,6 @@ -- @suppress_diff ||= @suppress_diff || @force_suppress_diff -- if @suppress_diff - .alert.alert-warning - %p - %strong Warning! This is a large diff. - %p - To preserve performance the diff is not shown. - - if current_controller?(:commit) or current_controller?(:merge_requests) - - if current_controller?(:commit) - Please, download the diff as - = link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined-link" - or - = link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined-link" - instead. - - elsif @merge_request && @merge_request.persisted? - Please, download the diff as - = link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined-link" - or - = link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined-link" - instead. - - unless @force_suppress_diff - %p - If you still want to see the diff - = link_to "click this link", url_for(force_show_diff: true), class: "underlined-link" - - .row .col-md-8 - .js-toggle-container - .commit-stat-summary - Showing - %strong.cdark #{pluralize(diffs.count, "changed file")} - - if current_controller?(:commit) - - unless @commit.has_zero_stats? - with - %strong.cgreen #{@commit.stats.additions} additions - and - %strong.cred #{@commit.stats.deletions} deletions - - = link_to '#', class: 'btn btn-small js-toggle-button' do - Show diff stats - %i.icon-chevron-down - .file-stats.js-toggle-content.hide - = render "projects/commits/diff_head", diffs: diffs + = render 'projects/commits/diff_stats', diffs: diffs .col-md-4 %ul.nav.nav-tabs %li.pull-right{class: params[:view] == 'parallel' ? 'active' : ''} @@ -49,53 +8,16 @@ %li.pull-right{class: params[:view] != 'parallel' ? 'active' : ''} = link_to "Inline Diff", url_for(view: 'inline'), {id: "commit-diff-viewtype"} -.files - - unless @suppress_diff - - diffs.each_with_index do |diff, i| - - file = project.repository.blob_at(@commit.id, diff.new_path) - - file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file - - next unless file - .diff-file{id: "diff-#{i}"} - .diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"} - - if diff.deleted_file - %span= diff.old_path - - .diff-btn-group - - if @commit.parent_ids.present? - = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), { class: 'btn btn-small view-file' } do - View file @ - %span.commit-short-id= @commit.short_id(6) - - else - %span= diff.new_path - - if diff_file_mode_changed?(diff) - %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" - - .diff-btn-group - = link_to "#", class: "js-toggle-diff-comments btn btn-small" do - %i.icon-chevron-down - Diff comments - - - - if @merge_request && @merge_request.source_project - = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do - Edit - - - = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), { class: 'btn btn-small view-file' } do - View file @ - %span.commit-short-id= @commit.short_id(6) +- if show_diff_size_warninig?(diffs) + = render 'projects/commits/diff_warning', diffs: diffs +.files + - safe_diff_files(diffs).each_with_index do |diff, i| + = render 'projects/commits/diff_file', diff: diff, i: i, project: project - .diff-content - -# Skipp all non non-supported blobs - - next unless file.respond_to?('text?') - - if file.text? - - if params[:view] == 'parallel' - = render "projects/commits/parallel_view", diff: diff, project: project, file: file, index: i - - else - = render "projects/commits/text_file", diff: diff, index: i - - elsif file.image? - - old_file = project.repository.blob_at(@commit.parent_id, diff.old_path) if @commit.parent_id - = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i - - else - .nothing-here-block No preview for this file type +- if @diff_timeout + .alert.alert-danger + %h4 + Failed to collect changes + %p + Maybe diff is really big and operation failed with timeout. Try to get diff localy |