Move star icon to header of CommitMessageBlock
Move star icon from the change screen header to header of CommitMessageBlock so we can remove the screen header. Change-Id: Ic24be6b7de304d896f84ea77e10799c0e7907793
This commit is contained in:
committed by
Shawn O. Pearce
parent
8ab61558d9
commit
5ea0bd7258
@@ -19,14 +19,15 @@ import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetInfo;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
|
||||
|
||||
public class ChangeDescriptionBlock extends Composite {
|
||||
private final ChangeInfoBlock infoBlock;
|
||||
private final CommitMessageBlock messageBlock;
|
||||
|
||||
public ChangeDescriptionBlock() {
|
||||
public ChangeDescriptionBlock(KeyCommandSet keysAction) {
|
||||
infoBlock = new ChangeInfoBlock();
|
||||
messageBlock = new CommitMessageBlock();
|
||||
messageBlock = new CommitMessageBlock(keysAction);
|
||||
|
||||
final HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.add(infoBlock);
|
||||
@@ -34,9 +35,9 @@ public class ChangeDescriptionBlock extends Composite {
|
||||
initWidget(hp);
|
||||
}
|
||||
|
||||
public void display(final Change chg, final PatchSetInfo info,
|
||||
public void display(Change chg, Boolean starred, PatchSetInfo info,
|
||||
final AccountInfoCache acc) {
|
||||
infoBlock.display(chg, acc);
|
||||
messageBlock.display(info.getMessage());
|
||||
messageBlock.display(chg.getId(), starred, info.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,16 +160,11 @@ public class ChangeScreen extends Screen
|
||||
keysNavigation.add(new ExpandCollapseDependencySectionKeyCommand(0, 'd', Util.C.expandCollapseDependencies()));
|
||||
|
||||
if (Gerrit.isSignedIn()) {
|
||||
StarredChanges.Icon star = StarredChanges.createIcon(changeId, false);
|
||||
star.setStyleName(Gerrit.RESOURCES.css().changeScreenStarIcon());
|
||||
setTitleWest(star);
|
||||
|
||||
keysAction.add(StarredChanges.newKeyCommand(star));
|
||||
keysAction.add(new PublishCommentsKeyCommand(0, 'r', Util.C
|
||||
.keyPublishComments()));
|
||||
}
|
||||
|
||||
descriptionBlock = new ChangeDescriptionBlock();
|
||||
descriptionBlock = new ChangeDescriptionBlock(keysAction);
|
||||
add(descriptionBlock);
|
||||
|
||||
approvals = new ApprovalTable();
|
||||
@@ -265,8 +260,10 @@ public class ChangeScreen extends Screen
|
||||
dependencies.setAccountInfoCache(detail.getAccounts());
|
||||
approvals.setAccountInfoCache(detail.getAccounts());
|
||||
|
||||
descriptionBlock.display(detail.getChange(), detail
|
||||
.getCurrentPatchSetDetail().getInfo(), detail.getAccounts());
|
||||
descriptionBlock.display(detail.getChange(),
|
||||
detail.isStarred(),
|
||||
detail.getCurrentPatchSetDetail().getInfo(),
|
||||
detail.getAccounts());
|
||||
dependsOn.display(detail.getDependsOn());
|
||||
neededBy.display(detail.getNeededBy());
|
||||
approvals.display(detail);
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
|
||||
package com.google.gerrit.client.changes;
|
||||
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.ui.CommentLinkProcessor;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
@@ -23,6 +25,8 @@ 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.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwtexpui.globalkey.client.KeyCommandSet;
|
||||
import com.google.gwtexpui.safehtml.client.SafeHtml;
|
||||
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
|
||||
|
||||
@@ -32,6 +36,10 @@ public class CommitMessageBlock extends Composite {
|
||||
|
||||
private static Binder uiBinder = GWT.create(Binder.class);
|
||||
|
||||
private KeyCommandSet keysAction;
|
||||
|
||||
@UiField
|
||||
SimplePanel starPanel;
|
||||
@UiField
|
||||
PreElement commitSummaryPre;
|
||||
@UiField
|
||||
@@ -41,7 +49,26 @@ public class CommitMessageBlock extends Composite {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public CommitMessageBlock(KeyCommandSet keysAction) {
|
||||
this.keysAction = keysAction;
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public void display(final String commitMessage) {
|
||||
display(null, null, commitMessage);
|
||||
}
|
||||
|
||||
public void display(Change.Id changeId, Boolean starred, String commitMessage) {
|
||||
if (changeId != null && starred != null && Gerrit.isSignedIn()) {
|
||||
StarredChanges.Icon star = StarredChanges.createIcon(changeId, starred);
|
||||
star.setStyleName(Gerrit.RESOURCES.css().changeScreenStarIcon());
|
||||
starPanel.add(star);
|
||||
|
||||
if (keysAction != null) {
|
||||
keysAction.add(StarredChanges.newKeyCommand(star));
|
||||
}
|
||||
}
|
||||
|
||||
String[] splitCommitMessage = commitMessage.split("\n", 2);
|
||||
|
||||
String commitSummary = splitCommitMessage[0];
|
||||
|
||||
@@ -62,11 +62,15 @@ limitations under the License.
|
||||
.commitBody {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.starPanel {
|
||||
float: left;
|
||||
}
|
||||
</ui:style>
|
||||
|
||||
<g:HTMLPanel>
|
||||
<table class='{style.commitMessageTable}'>
|
||||
<tr><td class='{style.header}'>Commit Message</td></tr>
|
||||
<tr><td class='{style.header}'><g:SimplePanel styleName='{style.starPanel}' ui:field='starPanel'></g:SimplePanel>Commit Message</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'/>
|
||||
|
||||
@@ -83,7 +83,7 @@ public class PublishCommentScreen extends AccountScreen implements
|
||||
addStyleName(Gerrit.RESOURCES.css().publishCommentsScreen());
|
||||
|
||||
approvalButtons = new ArrayList<ValueRadioButton>();
|
||||
descBlock = new ChangeDescriptionBlock();
|
||||
descBlock = new ChangeDescriptionBlock(null);
|
||||
add(descBlock);
|
||||
|
||||
final FormPanel form = new FormPanel();
|
||||
@@ -270,7 +270,7 @@ public class PublishCommentScreen extends AccountScreen implements
|
||||
private void display(final PatchSetPublishDetail r) {
|
||||
setPageTitle(Util.M.publishComments(r.getChange().getKey().abbreviate(),
|
||||
patchSetId.get()));
|
||||
descBlock.display(r.getChange(), r.getPatchSetInfo(), r.getAccounts());
|
||||
descBlock.display(r.getChange(), null, r.getPatchSetInfo(), r.getAccounts());
|
||||
|
||||
if (r.getChange().getStatus().isOpen()) {
|
||||
initApprovals(r, approvalPanel);
|
||||
|
||||
Reference in New Issue
Block a user