Commit 0ac83389 authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '42448-change-commit-row-actions-and-sha-design-for-project-commit-list' into 'master'

Implement a new SHA partial for commit lists

Closes #42448

See merge request gitlab-org/gitlab-ce!17406
parents e5d32c2c fccc09be
...@@ -107,7 +107,6 @@ ...@@ -107,7 +107,6 @@
} }
} }
.commits-compare-switch { .commits-compare-switch {
float: left; float: left;
margin-right: 9px; margin-right: 9px;
...@@ -179,7 +178,7 @@ ...@@ -179,7 +178,7 @@
.commit-detail { .commit-detail {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: center;
flex-grow: 1; flex-grow: 1;
.merge-request-branches & { .merge-request-branches & {
...@@ -200,37 +199,63 @@ ...@@ -200,37 +199,63 @@
} }
.ci-status-link { .ci-status-link {
display: inline-block; display: inline-flex;
position: relative;
top: 2px;
} }
.btn-clipboard, > .ci-status-link,
.btn-transparent { > .btn,
padding-left: 0; > .commit-sha-group {
padding-right: 0; margin-left: $gl-padding-8;
} }
}
.commit-sha-group {
display: inline-flex;
.label,
.btn { .btn {
&:not(:first-child) { padding: $gl-vert-padding $gl-btn-padding;
margin-left: $gl-padding; border: 1px $border-color solid;
font-size: $gl-font-size;
line-height: $line-height-base;
border-radius: 0;
display: flex;
align-items: center;
} }
.label-monospace {
@extend .monospace;
user-select: text;
color: $gl-text-color;
background-color: $gray-light;
} }
.commit-sha { .btn svg {
font-size: 14px; top: auto;
font-weight: $gl-font-weight-bold; fill: $gl-text-color-secondary;
} }
.ci-status-icon { .fa-clipboard {
position: relative; color: $gl-text-color-secondary;
top: 2px; }
:first-child {
border-bottom-left-radius: $border-radius-default;
border-top-left-radius: $border-radius-default;
}
:not(:first-child) {
border-left: 0;
}
:last-child {
border-bottom-right-radius: $border-radius-default;
border-top-right-radius: $border-radius-default;
} }
} }
.commit, .commit,
.generic_commit_status { .generic_commit_status {
a, a,
button { button {
color: $gl-text-color; color: $gl-text-color;
...@@ -303,10 +328,8 @@ ...@@ -303,10 +328,8 @@
} }
} }
.gpg-status-box { .gpg-status-box {
padding: 2px 10px; padding: 2px 10px;
margin-right: $gl-padding;
&:empty { &:empty {
display: none; display: none;
......
...@@ -93,25 +93,18 @@ module CommitsHelper ...@@ -93,25 +93,18 @@ module CommitsHelper
return unless current_controller?(:commits) return unless current_controller?(:commits)
if @path.blank? if @path.blank?
return link_to( url = project_tree_path(project, commit)
_("Browse Files"), tooltip = _("Browse Files")
project_tree_path(project, commit),
class: "btn btn-default"
)
elsif @repo.blob_at(commit.id, @path) elsif @repo.blob_at(commit.id, @path)
return link_to( url = project_blob_path(project, tree_join(commit.id, @path))
_("Browse File"), tooltip = _("Browse File")
project_blob_path(project,
tree_join(commit.id, @path)),
class: "btn btn-default"
)
elsif @path.present? elsif @path.present?
return link_to( url = project_tree_path(project, tree_join(commit.id, @path))
_("Browse Directory"), tooltip = _("Browse Directory")
project_tree_path(project, end
tree_join(commit.id, @path)),
class: "btn btn-default" link_to url, class: "btn btn-default has-tooltip", title: tooltip, data: { container: "body" } do
) sprite_icon('folder-open')
end end
end end
......
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
.commit-detail.flex-list .commit-detail.flex-list
.commit-content .commit-content
- if view_details && merge_request
= link_to commit.title, project_commit_path(project, commit.id, merge_request_iid: merge_request.iid), class: "commit-row-message item-title"
- else
= link_to_markdown_field(commit, :title, link, class: "commit-row-message item-title") = link_to_markdown_field(commit, :title, link, class: "commit-row-message item-title")
%span.commit-row-message.visible-xs-inline %span.commit-row-message.visible-xs-inline
· ·
...@@ -52,9 +55,9 @@ ...@@ -52,9 +55,9 @@
= render_commit_status(commit, ref: ref) = render_commit_status(commit, ref: ref)
.js-commit-pipeline-status{ data: { endpoint: pipelines_project_commit_path(project, commit.id) } } .js-commit-pipeline-status{ data: { endpoint: pipelines_project_commit_path(project, commit.id) } }
= link_to commit.short_id, link, class: "commit-sha btn btn-transparent btn-link"
= clipboard_button(text: commit.id, title: _("Copy commit SHA to clipboard"))
= link_to_browse_code(project, commit)
- if view_details && merge_request .commit-sha-group
= link_to "View details", project_commit_path(project, commit.id, merge_request_iid: merge_request.iid), class: "btn btn-default" .label.label-monospace
= commit.short_id
= clipboard_button(text: commit.id, title: _("Copy commit SHA to clipboard"), class: "btn btn-default", container: "body")
= link_to_browse_code(project, commit)
---
title: Improved visual styles and consistency for commit hash and possible actions
across commit lists
merge_request: 17406
author:
type: changed
...@@ -28,6 +28,6 @@ describe 'projects/merge_requests/_commits.html.haml' do ...@@ -28,6 +28,6 @@ describe 'projects/merge_requests/_commits.html.haml' do
commit = merge_request.commits.first # HEAD commit = merge_request.commits.first # HEAD
href = diffs_project_merge_request_path(target_project, merge_request, commit_id: commit) href = diffs_project_merge_request_path(target_project, merge_request, commit_id: commit)
expect(rendered).to have_link(Commit.truncate_sha(commit.sha), href: href) expect(rendered).to have_link(href: href)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment