Improve display of long user names for collapsed comments in history
The width of the column in which user names for collapsed comments are shown in the history on the change screen is fixed so that long user names get truncated, e.g. 'AutomaticGerritVoterLinux' is shown as 'AutomaticGerritVo...'. This is bad if there are several users with long user names that have the same prefix, e.g. 'AutomaticGerritVoterWindows' would be also shown as 'AutomaticGerritVo...' and a user must expand the comment to see the full user name. Improve this by inserting the ellipsis in the middle of the user name so that the start and end of the user name are always visible, e.g. "AutomaticG...VoterLinux" and "AutomaticG...terWindows". Also slightly increase the width of the column that is used for user names of collapsed comments. Bug: issue 2837 Change-Id: I995a848381a31b44f60e018fb1173351766df587 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -89,7 +89,7 @@ class Message extends Composite {
|
||||
this.history = parent;
|
||||
this.info = info;
|
||||
|
||||
name.setInnerText(authorName(info));
|
||||
setName(false);
|
||||
date.setInnerText(FormatUtil.shortFormatDayTime(info.date()));
|
||||
if (info.message() != null) {
|
||||
String msg = info.message().trim();
|
||||
@@ -129,6 +129,7 @@ class Message extends Composite {
|
||||
commentList = Collections.emptyList();
|
||||
}
|
||||
}
|
||||
setName(open);
|
||||
|
||||
UIObject.setVisible(summary, !open);
|
||||
UIObject.setVisible(message, open);
|
||||
@@ -140,6 +141,17 @@ class Message extends Composite {
|
||||
}
|
||||
}
|
||||
|
||||
private void setName(boolean open) {
|
||||
name.setInnerText(open ? authorName(info) : elide(authorName(info), 20));
|
||||
}
|
||||
|
||||
private static String elide(final String s, final int len) {
|
||||
if (s == null || s.length() < len || len <= 10) {
|
||||
return s;
|
||||
}
|
||||
return s.substring(0, len - 10) + "..." + s.substring(s.length() - 10);
|
||||
}
|
||||
|
||||
void autoOpen() {
|
||||
if (commentList == null) {
|
||||
autoOpen = true;
|
||||
|
||||
@@ -64,9 +64,8 @@ limitations under the License.
|
||||
font-weight: bold;
|
||||
}
|
||||
.closed .name {
|
||||
width: 120px;
|
||||
width: 150px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ limitations under the License.
|
||||
color: #777;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 120px;
|
||||
left: 150px;
|
||||
width: 880px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
Reference in New Issue
Block a user