From c741fcab9d8f1a28b2b95e3cd2096adc5178eba6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> Date: Mon, 8 Sep 2014 20:41:55 +0300 Subject: [PATCH] Fix all broken stuff after diff refactoring Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> --- app/views/projects/commits/_diffs.html.haml | 26 ------------------- app/views/projects/compare/show.html.haml | 2 +- app/views/projects/diffs/_diff_file.html.haml | 2 +- .../projects/diffs/_diff_warning.html.haml | 2 +- app/views/projects/diffs/_image.html.haml | 1 + .../merge_requests/_new_submit.html.haml | 2 +- 6 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 app/views/projects/commits/_diffs.html.haml diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml deleted file mode 100644 index 056524fc136..00000000000 --- a/app/views/projects/commits/_diffs.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -.row - .col-md-8 - = render 'projects/commits/diff_stats', diffs: diffs - .col-md-4 - %ul.nav.nav-tabs - %li.pull-right{class: params[:view] == 'parallel' ? 'active' : ''} - - params_copy = params.dup - - params_copy[:view] = 'parallel' - = link_to "Side-by-side Diff", url_for(params_copy), {id: "commit-diff-viewtype"} - %li.pull-right{class: params[:view] != 'parallel' ? 'active' : ''} - - params_copy[:view] = 'inline' - = link_to "Inline Diff", url_for(params_copy), {id: "commit-diff-viewtype"} - -- if show_diff_size_warninig?(diffs) - = render 'projects/diffs/diff_warning', diffs: diffs - -.files - - safe_diff_files(diffs).each_with_index do |diff, i| - = render 'projects/diffs/diff_file', diff: diff_file, i: i, project: project - -- 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 diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml index aa79d08509b..45269e662cd 100644 --- a/app/views/projects/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -18,7 +18,7 @@ - else %ul.well-list= render Commit.decorate(@commits), project: @project - = render "projects/commits/diffs", diffs: @diffs, project: @project + = render "projects/diffs/diffs", diffs: @diffs, project: @project - else .light-well diff --git a/app/views/projects/diffs/_diff_file.html.haml b/app/views/projects/diffs/_diff_file.html.haml index c79f9dc0149..aa68becc4dd 100644 --- a/app/views/projects/diffs/_diff_file.html.haml +++ b/app/views/projects/diffs/_diff_file.html.haml @@ -41,7 +41,7 @@ = render "projects/diffs/text_file", diff_file: diff_file, index: i - elsif blob.image? - old_file = project.repository.prev_blob_for_diff(@commit, diff_file) - = render "projects/diffs/image", diff_file: diff_file, old_file: old_file, blob: blob, index: i + = render "projects/diffs/image", diff_file: diff_file, old_file: old_file, file: blob, index: i - else .nothing-here-block No preview for this file type diff --git a/app/views/projects/diffs/_diff_warning.html.haml b/app/views/projects/diffs/_diff_warning.html.haml index 05d516efa11..ee85956d876 100644 --- a/app/views/projects/diffs/_diff_warning.html.haml +++ b/app/views/projects/diffs/_diff_warning.html.haml @@ -14,6 +14,6 @@ = link_to "Email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "btn btn-warning btn-small" %p To preserve performance only - %strong #{safe_diff_files(diffs).size} of #{diffs.size} + %strong #{safe_diff_files(@project, diffs).size} of #{diffs.size} files displayed. diff --git a/app/views/projects/diffs/_image.html.haml b/app/views/projects/diffs/_image.html.haml index 6d9ef5964d9..900646dd0a4 100644 --- a/app/views/projects/diffs/_image.html.haml +++ b/app/views/projects/diffs/_image.html.haml @@ -1,3 +1,4 @@ +- diff = diff_file.diff - if diff.renamed_file || diff.new_file || diff.deleted_file .image %span.wrap diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index dc3f9d592f6..e013fd6d1ce 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -75,7 +75,7 @@ %h4 Changes - if @diffs.present? - = render "projects/commits/diffs", diffs: @diffs, project: @project + = render "projects/diffs/diffs", diffs: @diffs, project: @project - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE .bs-callout.bs-callout-danger %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits. -- GitLab