debian-mirror-gitlab/app/views/projects/commits/_commits.html.haml

54 lines
3.1 KiB
Text
Raw Normal View History

2018-03-17 18:26:18 +05:30
- 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-10-24 23:57:45 +05:30
- can_update_merge_request = can?(current_user, :update_merge_request, @merge_request)
2018-03-17 18:26:18 +05:30
2021-06-08 01:23:25 +05:30
- commits = @commits&.map { |commit| commit.present(current_user: current_user) }
- context_commits = @context_commits&.map { |commit| commit.present(current_user: current_user) }
2018-11-20 20:47:30 +05:30
- hidden = @hidden_commit_count
2016-06-02 11:05:42 +05:30
2020-05-05 14:28:15 +05:30
- commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, daily_commits|
2017-09-10 17:25:29 +05:30
%li.commit-header.js-commit-header{ data: { day: day } }
%span.day= l(day, format: '%d %b, %Y')
2020-05-05 14:28:15 +05:30
%span.commits-count= n_("%d commit", "%d commits", daily_commits.size) % daily_commits.size
2017-09-10 17:25:29 +05:30
%li.commits-row{ data: { day: day } }
%ul.content-list.commit-list.flex-list
2022-07-16 23:28:13 +05:30
- if Feature.enabled?(:cached_commits, project)
2021-06-08 01:23:25 +05:30
= render partial: 'projects/commits/commit', collection: daily_commits, locals: { project: project, ref: ref, merge_request: merge_request }, cached: -> (commit) { commit_partial_cache_key(commit, ref: ref, merge_request: merge_request, request: request) }
- else
= render partial: 'projects/commits/commit', collection: daily_commits, locals: { project: project, ref: ref, merge_request: merge_request }
2016-06-02 11:05:42 +05:30
2020-10-24 23:57:45 +05:30
- 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
2022-05-07 20:08:51 +05:30
- if can_update_merge_request
2022-07-23 23:45:48 +05:30
= render Pajamas::ButtonComponent.new(button_options: { class: 'gl-ml-3 add-review-item-modal-trigger', data: { context_commits_empty: 'false' } }) do
2020-10-24 23:57:45 +05:30
= _('Add/remove')
%li.commits-row
%ul.content-list.commit-list.flex-list
2022-07-16 23:28:13 +05:30
- if Feature.enabled?(:cached_commits, project)
2021-06-08 01:23:25 +05:30
= render partial: 'projects/commits/commit', collection: context_commits, locals: { project: project, ref: ref, merge_request: merge_request }, cached: -> (commit) { commit_partial_cache_key(commit, ref: ref, merge_request: merge_request, request: request) }
- else
= render partial: 'projects/commits/commit', collection: context_commits, locals: { project: project, ref: ref, merge_request: merge_request }
2020-10-24 23:57:45 +05:30
2016-06-02 11:05:42 +05:30
- if hidden > 0
2022-05-07 20:08:51 +05:30
%li
2022-06-21 17:19:12 +05:30
= render Pajamas::AlertComponent.new(variant: :warning,
2022-07-16 23:28:13 +05:30
dismissible: false) do |c|
= c.body do
2021-09-04 01:27:46 +05:30
= 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-22 19:07:51 +05:30
2022-05-07 20:08:51 +05:30
- if can_update_merge_request && context_commits&.empty?
2022-08-27 11:52:29 +05:30
= render Pajamas::ButtonComponent.new(button_options: { class: 'gl-mt-5 add-review-item-modal-trigger', data: { context_commits_empty: 'true' } }) do
2020-10-24 23:57:45 +05:30
= _('Add previously merged commits')
- if commits.size == 0 && context_commits.nil?
2021-02-22 17:27:13 +05:30
.commits-empty.gl-mt-6
= custom_icon('illustration_no_commits')
%h4
2020-04-22 19:07:51 +05:30
= _('Your search didn\'t match any commits.')
2021-02-22 17:27:13 +05:30
%p
= _('Try changing or removing filters.')