Move permalink next to commit message box header

Remove permalink from change info block and instead add next to the
commit message box.

Change-Id: I0077d290cb71bb5928fdfd7c2030df331f547a84
This commit is contained in:
Keunhong Park
2012-06-19 09:19:29 -06:00
parent 174a012288
commit 7c57f3c686
5 changed files with 31 additions and 24 deletions

View File

@@ -168,7 +168,6 @@ public interface GerritCss extends CssResource {
String patchSetRevision();
String patchSetUserIdentity();
String patchSizeCell();
String permalink();
String pluginsTable();
String posscore();
String projectAdminApprovalCategoryRangeLine();

View File

@@ -19,13 +19,11 @@ import static com.google.gerrit.client.FormatUtil.mediumFormat;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.ui.AccountLink;
import com.google.gerrit.client.ui.BranchLink;
import com.google.gerrit.client.ui.ChangeLink;
import com.google.gerrit.client.ui.ProjectLink;
import com.google.gerrit.common.data.AccountInfoCache;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
import com.google.gwtexpui.clippy.client.CopyableLabel;
@@ -40,18 +38,15 @@ public class ChangeInfoBlock extends Composite {
private static final int R_UPDATED = 6;
private static final int R_STATUS = 7;
private static final int R_MERGE_TEST = 8;
private final int R_PERMALINK;
private static final int R_CNT = 10;
private static final int R_CNT = 9;
private final Grid table;
public ChangeInfoBlock() {
if (Gerrit.getConfig().testChangeMerge()) {
table = new Grid(R_CNT, 2);
R_PERMALINK = 9;
} else {
table = new Grid(R_CNT - 1, 2);
R_PERMALINK = 8;
}
table.setStyleName(Gerrit.RESOURCES.css().infoBlock());
table.addStyleName(Gerrit.RESOURCES.css().changeInfoBlock());
@@ -73,8 +68,6 @@ public class ChangeInfoBlock extends Composite {
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(R_CHANGE_ID, 1, Gerrit.RESOURCES.css().changeid());
fmt.addStyleName(R_CNT - 2, 0, Gerrit.RESOURCES.css().bottomheader());
fmt.addStyleName(R_PERMALINK, 0, Gerrit.RESOURCES.css().permalink());
fmt.addStyleName(R_PERMALINK, 1, Gerrit.RESOURCES.css().permalink());
initWidget(table);
}
@@ -111,10 +104,5 @@ public class ChangeInfoBlock extends Composite {
} else {
table.getCellFormatter().removeStyleName(R_STATUS, 1, Gerrit.RESOURCES.css().closedstate());
}
final FlowPanel fp = new FlowPanel();
fp.add(new ChangeLink(Util.C.changePermalink(), chg.getId()));
fp.add(new CopyableLabel(ChangeLink.permalink(chg.getId()), false));
table.setWidget(R_PERMALINK, 1, fp);
}
}

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.client.changes;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.ui.ChangeLink;
import com.google.gerrit.client.ui.CommentLinkProcessor;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gwt.user.client.ui.Composite;
@@ -24,8 +25,10 @@ import com.google.gwt.dom.client.PreElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwtexpui.clippy.client.CopyableLabel;
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
import com.google.gwtexpui.safehtml.client.SafeHtml;
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
@@ -41,6 +44,8 @@ public class CommitMessageBlock extends Composite {
@UiField
SimplePanel starPanel;
@UiField
FlowPanel permalinkPanel;
@UiField
PreElement commitSummaryPre;
@UiField
PreElement commitBodyPre;
@@ -69,6 +74,9 @@ public class CommitMessageBlock extends Composite {
}
}
permalinkPanel.add(new ChangeLink(Util.C.changePermalink(), changeId));
permalinkPanel.add(new CopyableLabel(ChangeLink.permalink(changeId), false));
String[] splitCommitMessage = commitMessage.split("\n", 2);
String commitSummary = splitCommitMessage[0];

View File

@@ -66,11 +66,32 @@ limitations under the License.
.starPanel {
float: left;
}
.boxTitle {
float: left;
margin-right: 10px;
}
.permalinkPanel {
float: right;
}
.permalinkPanel a {
float: left;
}
.permalinkPanel div {
display: inline;
}
</ui:style>
<g:HTMLPanel>
<table class='{style.commitMessageTable}'>
<tr><td class='{style.header}'><g:SimplePanel styleName='{style.starPanel}' ui:field='starPanel'></g:SimplePanel>Commit Message</td></tr>
<tr><td class='{style.header}'>
<g:SimplePanel styleName='{style.starPanel}' ui:field='starPanel'></g:SimplePanel>
<div class='{style.boxTitle}'>Commit Message</div>
<g:FlowPanel styleName='{style.permalinkPanel}' ui:field='permalinkPanel'></g:FlowPanel>
</td></tr>
<tr><td class='{style.contents}'>
<pre class='{style.commitSummary} {res.css.changeScreenDescription}' ui:field='commitSummaryPre'/>
<pre class='{style.commitBody} {res.css.changeScreenDescription}' ui:field='commitBodyPre'/>

View File

@@ -914,15 +914,6 @@
font-weight: bold;
}
.infoBlock td.permalink {
border-right: 1px none;
border-bottom: 1px none;
text-align: right;
}
.infoBlock td.permalink div div {
display: inline;
}
.infoBlock td.useridentity {
white-space: nowrap;
}