From 39ca6873070433e84c62fbdeab1f3516ba8f3d9e Mon Sep 17 00:00:00 2001 From: Tao Zhou Date: Thu, 14 May 2020 12:56:18 +0200 Subject: [PATCH] Move file status to a chip at the end of the file name screenshot: https://imgur.com/a/TWENery Change-Id: I83873a0caf58ba37d7ecad23272ed37ecf93b765 --- .../change/gr-file-list/gr-file-list.js | 5 ++ .../change/gr-file-list/gr-file-list_html.js | 47 +++++++++++++------ 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js index 2e0584e0f5..135556945c 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js @@ -952,6 +952,11 @@ class GrFileList extends mixinBehaviors( [ return classes.join(' '); } + _computeStatusClass(file) { + const classStr = this._computeClass('status', file.__path); + return `${classStr} ${this._computeFileStatus(file.status)}`; + } + _computePathClass(path, expandedFilesRecord) { return this._isFileExpanded(path, expandedFilesRecord) ? 'expanded' : ''; } diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js index 42e07f5038..df6f43dcaa 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_html.js @@ -26,8 +26,7 @@ export const htmlTemplate = html` border-top: 1px solid var(--border-color); display: flex; min-height: calc(var(--line-height-normal) + 2 * var(--spacing-s)); - padding: var(--spacing-xs) var(--spacing-l) var(--spacing-xs) - calc(var(--spacing-l) - 0.35rem); + padding: var(--spacing-xs) var(--spacing-l); } :host(.loading) .row { opacity: 0.5; @@ -62,12 +61,31 @@ export const htmlTemplate = html` align-items: center; display: inline-flex; } - .reviewed, - .status { + .reviewed { display: inline-block; text-align: left; width: 1.5em; } + .status { + display: inline-block; + border-radius: var(--border-radius); + margin-left: var(--spacing-s); + padding: 0 var(--spacing-m); + color: var(--primary-text-color); + font-size: var(--font-size-small); + background-color: var(--dark-add-highlight-color); + } + .status.M { + display: none; + } + .status.D, + .status.R, + .status.W { + background-color: var(--dark-remove-highlight-color); + } + .status.U { + background-color: var(--comment-background-color); + } .file-row { cursor: pointer; } @@ -221,7 +239,8 @@ export const htmlTemplate = html` padding: var(--spacing-s) 0; text-decoration: none; } - .pathLink:hover { + .pathLink:hover span.fullFileName, + .pathLink:hover span.truncatedFileName { text-decoration: underline; } @@ -231,7 +250,6 @@ export const htmlTemplate = html` display: inline-block; visibility: hidden; vertical-align: bottom; - text-decoration: none; --gr-button: { padding: 0px; } @@ -277,7 +295,6 @@ export const htmlTemplate = html`
-
File
Comments
Size
@@ -313,14 +330,6 @@ export const htmlTemplate = html` data-file$="[[_computeFileRange(file)]]" tabindex="-1" > -
- [[_computeFileStatus(file.status)]] -
[[computeTruncatedPath(file.__path)]] + + [[_computeFileStatusLabel(file.status)]] +