diff options
Diffstat (limited to 'app/views/projects/commits')
-rw-r--r-- | app/views/projects/commits/_commit.html.haml | 7 | ||||
-rw-r--r-- | app/views/projects/commits/_commits.html.haml | 19 | ||||
-rw-r--r-- | app/views/projects/commits/show.html.haml | 4 |
3 files changed, 24 insertions, 6 deletions
diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml index ab1d855a6e0..33fedde0cd1 100644 --- a/app/views/projects/commits/_commit.html.haml +++ b/app/views/projects/commits/_commit.html.haml @@ -10,12 +10,13 @@ - ref = local_assigns.fetch(:ref) { merge_request&.source_branch } - commit = commit.present(current_user: current_user) - commit_status = commit.status_for(ref) +- collapsible = local_assigns.fetch(:collapsible, true) - link = commit_path(project, commit, merge_request: merge_request) - show_project_name = local_assigns.fetch(:show_project_name, false) -%li.commit.flex-row.js-toggle-container{ id: "commit-#{commit.short_id}" } +%li{ class: ["commit flex-row", ("js-toggle-container" if collapsible)], id: "commit-#{commit.short_id}" } .avatar-cell.d-none.d-sm-block = author_avatar(commit, size: 40, has_tooltip: false) @@ -29,7 +30,7 @@ %span.commit-row-message.d-inline.d-sm-none · = commit.short_id - - if commit.description? + - if commit.description? && collapsible %button.text-expander.js-toggle-button = sprite_icon('ellipsis_h', size: 12) @@ -41,7 +42,7 @@ = render_if_exists 'projects/commits/project_namespace', show_project_name: show_project_name, project: project - if commit.description? - %pre.commit-row-description.js-toggle-content.gl-mb-3 + %pre{ class: ["commit-row-description gl-mb-3", (collapsible ? "js-toggle-content" : "d-block")] } = preserve(markdown_field(commit, :description)) .commit-actions.flex-row diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml index e413bd78789..293500a6c31 100644 --- a/app/views/projects/commits/_commits.html.haml +++ b/app/views/projects/commits/_commits.html.haml @@ -1,8 +1,10 @@ - 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 } +- can_update_merge_request = can?(current_user, :update_merge_request, @merge_request) - commits = @commits +- context_commits = @context_commits - hidden = @hidden_commit_count - commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, daily_commits| @@ -14,11 +16,26 @@ %ul.content-list.commit-list.flex-list = render partial: 'projects/commits/commit', collection: daily_commits, locals: { project: project, ref: ref, merge_request: merge_request } +- 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 + %button.btn.btn-default.ml-3.add-review-item-modal-trigger{ type: "button", data: { context_commits_empty: 'false' } } + = _('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 } + - if hidden > 0 %li.alert.alert-warning = 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) -- if commits.size == 0 +- if project.context_commits_enabled? && can_update_merge_request && context_commits&.empty? + %button.btn.btn-default.mt-3.add-review-item-modal-trigger{ type: "button", data: { context_commits_empty: 'true' } } + = _('Add previously merged commits') + +- if commits.size == 0 && context_commits.nil? .mt-4.text-center .bold = _('Your search didn\'t match any commits.') diff --git a/app/views/projects/commits/show.html.haml b/app/views/projects/commits/show.html.haml index 737e4f66dd2..28b5dc0cc67 100644 --- a/app/views/projects/commits/show.html.haml +++ b/app/views/projects/commits/show.html.haml @@ -26,8 +26,8 @@ = form_tag(project_commits_path(@project, @id), method: :get, class: 'commits-search-form js-signature-container', data: { 'signatures-path' => namespace_project_signatures_path }) do = search_field_tag :search, params[:search], { placeholder: _('Search by message'), id: 'commits-search', class: 'form-control search-text-input input-short gl-mt-3 gl-sm-mt-0 gl-min-w-full', spellcheck: false } .control.d-none.d-md-block - = link_to project_commits_path(@project, @ref, rss_url_options), title: _("Commits feed"), class: 'btn' do - = icon("rss") + = link_to project_commits_path(@project, @ref, rss_url_options), title: _("Commits feed"), class: 'btn btn-svg' do + = sprite_icon('rss', css_class: 'qa-rss-icon') = render_if_exists 'projects/commits/mirror_status' |