Skip to content

Commit

Permalink
Make tables 100% wide. Move comments menu bar to title.
Browse files Browse the repository at this point in the history
Instead of using 95/98% wide tables, use all space (100%) with
correct padding/margins/flows.

Make comments a little bit prettier by moving menubar to title.

Change-Id: I974fe63a4e1c532a3cdb1fb6a53240fab2008b70
Signed-off-by: Shawn O. Pearce <[email protected]>
  • Loading branch information
anatol authored and spearce committed Sep 15, 2010
1 parent 3a00bc4 commit 6a64c95
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public interface GerritCss extends CssResource {
String commentPanelHeader();
String commentPanelLast();
String commentPanelMessage();
String commentPanelMenuBar();
String commentPanelSummary();
String commentPanelSummaryCell();
String complexHeader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
}

.logo {
width: 98%;
text-align: right;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
import com.google.gerrit.common.data.ToggleStarRequest;
import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.Change.Status;
import com.google.gerrit.reviewdb.ChangeMessage;
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.reviewdb.Change.Status;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
Expand Down Expand Up @@ -182,7 +183,7 @@ public void onClick(final ClickEvent event) {

dependencies = new ChangeTable() {
{
table.setWidth("98%");
table.setWidth("auto");
}
};
dependsOn = new ChangeTable.Section(Util.C.changeScreenDependsOn());
Expand All @@ -192,7 +193,6 @@ public void onClick(final ClickEvent event) {

dependenciesPanel = new DisclosurePanel(Util.C.changeScreenDependencies());
dependenciesPanel.setContent(dependencies);
dependenciesPanel.setWidth("95%");
add(dependenciesPanel);

patchSetsBlock = new PatchSetsBlock(this);
Expand Down Expand Up @@ -272,15 +272,17 @@ private void display(final ChangeDetail detail) {
private void addComments(final ChangeDetail detail) {
comments.clear();

final Label hdr = new Label(Util.C.changeScreenComments());
hdr.setStyleName(Gerrit.RESOURCES.css().blockHeader());
comments.add(hdr);

final AccountInfoCache accts = detail.getAccounts();
final List<ChangeMessage> msgList = detail.getMessages();

HorizontalPanel title = new HorizontalPanel();
title.setWidth("100%");
title.add(new Label(Util.C.changeScreenComments()));
if (msgList.size() > 1) {
comments.add(messagesMenuBar());
title.add(messagesMenuBar());
}
title.setStyleName(Gerrit.RESOURCES.css().blockHeader());
comments.add(title);

final long AGE = 7 * 24 * 60 * 60 * 1000L;
final Timestamp aged = new Timestamp(System.currentTimeMillis() - AGE);
Expand Down Expand Up @@ -316,24 +318,22 @@ private void addComments(final ChangeDetail detail) {
comments.add(cp);
}

if (msgList.size() > 1) {
comments.add(messagesMenuBar());
}
comments.setVisible(msgList.size() > 0);
}

private LinkMenuBar messagesMenuBar() {
final Panel c = comments;
final LinkMenuBar m = new LinkMenuBar();
m.addItem(Util.C.messageExpandRecent(), new ExpandAllCommand(c, true) {
final LinkMenuBar menuBar = new LinkMenuBar();
menuBar.addItem(Util.C.messageExpandRecent(), new ExpandAllCommand(c, true) {
@Override
protected void expand(final CommentPanel w) {
w.setOpen(w.isRecent());
}
});
m.addItem(Util.C.messageExpandAll(), new ExpandAllCommand(c, true));
m.addItem(Util.C.messageCollapseAll(), new ExpandAllCommand(c, false));
return m;
menuBar.addItem(Util.C.messageExpandAll(), new ExpandAllCommand(c, true));
menuBar.addItem(Util.C.messageCollapseAll(), new ExpandAllCommand(c, false));
menuBar.addStyleName(Gerrit.RESOURCES.css().commentPanelMenuBar());
return menuBar;
}

private void toggleStar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
font-size: 11pt;
padding-left: 5px;
padding-right: 5px;
width: 98%;
}

.version,
Expand Down Expand Up @@ -199,6 +198,9 @@
padding-left: 0.5em;
padding-right: 0.5em;
}
.commentPanelMenuBar {
float: right;
}
.commentPanelMessage p {
margin-top: 0px;
margin-bottom: 0px;
Expand Down Expand Up @@ -767,8 +769,7 @@
}

.changeComments {
margin-left: 0.5em;
margin-right: 0.5em;
padding-top: 1em;
width: 60em;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HistoryTable extends FancyFlexTable<Patch> {
HistoryTable(final PatchScreen parent) {
setStyleName(Gerrit.RESOURCES.css().patchHistoryTable());
screen = parent;
table.setWidth("98%");
table.setWidth("auto");
table.addStyleName(Gerrit.RESOURCES.css().changeTable());
}

Expand Down

0 comments on commit 6a64c95

Please sign in to comment.