2017-06-29 21:19:09 +00:00
- merge_request = local_assigns.fetch(:merge_request, nil)
- project = local_assigns.fetch(:project) { merge_request&.project }
- ref = local_assigns.fetch(:ref) { merge_request&.source_branch }
2020-08-04 18:09:49 +00:00
- can_update_merge_request = can?(current_user, :update_merge_request, @merge_request)
2017-06-29 21:19:09 +00:00
2018-08-21 17:47:04 +00:00
- commits = @commits
2020-08-04 18:09:49 +00:00
- context_commits = @context_commits
2018-08-21 17:47:04 +00:00
- hidden = @hidden_commit_count
2015-01-17 22:54:54 +00:00
2020-04-25 00:10:07 +00:00
- commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, daily_commits|
2017-06-03 01:40:20 +00:00
%li.commit-header.js-commit-header{ data: { day: day } }
2017-06-09 16:17:16 +00:00
%span.day= l(day, format: '%d %b, %Y')
2020-04-25 00:10:07 +00:00
%span.commits-count= n_("%d commit", "%d commits", daily_commits.size) % daily_commits.size
2017-06-03 01:40:20 +00:00
%li.commits-row{ data: { day: day } }
2017-07-06 14:30:43 +00:00
%ul.content-list.commit-list.flex-list
2020-04-25 00:10:07 +00:00
= render partial: 'projects/commits/commit', collection: daily_commits, locals: { project: project, ref: ref, merge_request: merge_request }
2016-03-04 14:20:30 +00:00
2020-08-04 18:09:49 +00:00
- if context_commits.present?
%li.commit-header.js-commit-header
%span.font-weight-bold= n_("%d previously merged commit", "%d previously merged commits", context_commits.count) % context_commits.count
- if project.context_commits_enabled? && can_update_merge_request
2021-04-10 03:09:09 +00:00
%button.gl-button.btn.btn-default.ml-3.add-review-item-modal-trigger{ type: "button", data: { context_commits_empty: 'false' } }
2020-08-04 18:09:49 +00:00
= _('Add/remove')
%li.commits-row
%ul.content-list.commit-list.flex-list
= render partial: 'projects/commits/commit', collection: context_commits, locals: { project: project, ref: ref, merge_request: merge_request }
2016-03-04 14:45:58 +00:00
- if hidden > 0
2020-09-23 12:09:58 +00:00
%li.gl-alert.gl-alert-warning
= sprite_icon('warning', size: 16, css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title')
2017-07-05 15:54:33 +00:00
= n_('%s additional commit has been omitted to prevent performance issues.', '%s additional commits have been omitted to prevent performance issues.', hidden) % number_with_delimiter(hidden)
2020-04-16 09:09:37 +00:00
2020-08-04 18:09:49 +00:00
- if project.context_commits_enabled? && can_update_merge_request && context_commits&.empty?
2021-04-10 03:09:09 +00:00
%button.gl-button.btn.btn-default.mt-3.add-review-item-modal-trigger{ type: "button", data: { context_commits_empty: 'true' } }
2020-08-04 18:09:49 +00:00
= _('Add previously merged commits')
- if commits.size == 0 && context_commits.nil?
2020-12-02 09:09:50 +00:00
.commits-empty.gl-mt-6
= custom_icon('illustration_no_commits')
%h4
2020-04-16 09:09:37 +00:00
= _('Your search didn\'t match any commits.')
2020-12-02 09:09:50 +00:00
%p
= _('Try changing or removing filters.')