From 1da0c0b6e43198074e775549011b73533fd3f64a Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sun, 31 Aug 2014 13:06:23 +0200 Subject: [PATCH] Factor out commit list from compare and new MR. --- app/views/projects/commits/_commit_list.html.haml | 11 +++++++++++ app/views/projects/compare/show.html.haml | 14 +------------- .../projects/merge_requests/_new_submit.html.haml | 12 +----------- 3 files changed, 13 insertions(+), 24 deletions(-) create mode 100644 app/views/projects/commits/_commit_list.html.haml diff --git a/app/views/projects/commits/_commit_list.html.haml b/app/views/projects/commits/_commit_list.html.haml new file mode 100644 index 00000000000..2ee7d73bd20 --- /dev/null +++ b/app/views/projects/commits/_commit_list.html.haml @@ -0,0 +1,11 @@ +%div.panel.panel-default + .panel-heading + Commits (#{@commits.count}) + - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE + %ul.well-list + - Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)).each do |commit| + = render "projects/commits/inline_commit", commit: commit, project: @project + %li.warning-row.unstyled + other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues. + - else + %ul.well-list= render Commit.decorate(@commits), project: @project diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml index 45269e662cd..214b5bd337b 100644 --- a/app/views/projects/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -6,20 +6,8 @@ = render "form" - if @commits.present? - %div.panel.panel-default - .panel-heading - Commits (#{@commits.count}) - - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE - %ul.well-list - - Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)).each do |commit| - = render "projects/commits/inline_commit", commit: commit, project: @project - %li.warning-row.unstyled - other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues. - - else - %ul.well-list= render Commit.decorate(@commits), project: @project - + = render "projects/commits/commit_list" = render "projects/diffs/diffs", diffs: @diffs, project: @project - - else .light-well .center diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index 657a77eb758..b19c4ad7658 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -66,17 +66,7 @@ = f.submit 'Submit merge request', class: "btn btn-create" .mr-compare - %div.panel.panel-default - .panel-heading - Commits (#{@commits.count}) - - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE - %ul.well-list - - Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)).each do |commit| - = render "projects/commits/inline_commit", commit: commit, project: @project - %li.warning-row.unstyled - other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues. - - else - %ul.well-list= render Commit.decorate(@commits), project: @project + = render "projects/commits/commit_list" %h4 Changes - if @diffs.present?