Merge "Improve display of long user names for collapsed comments in history"
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