Change the account dashboard screen to say the user's full name
Since the screen is generic and is used for both my and not-my pages we really should make it explicit. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -16,7 +16,7 @@ package com.google.gerrit.client;
|
||||
|
||||
import com.google.gerrit.client.account.AccountSettings;
|
||||
import com.google.gerrit.client.changes.ChangeScreen;
|
||||
import com.google.gerrit.client.changes.MineScreen;
|
||||
import com.google.gerrit.client.changes.AccountDashboardScreen;
|
||||
import com.google.gerrit.client.changes.MineStarredScreen;
|
||||
import com.google.gerrit.client.data.AccountInfo;
|
||||
import com.google.gerrit.client.data.ChangeInfo;
|
||||
@@ -63,7 +63,7 @@ public class Link implements HistoryListener {
|
||||
return new AccountSettings();
|
||||
|
||||
else if (MINE.equals(token))
|
||||
return new MineScreen();
|
||||
return new AccountDashboardScreen();
|
||||
|
||||
else if (MINE_STARRED.equals(token))
|
||||
return new MineStarredScreen();
|
||||
@@ -75,7 +75,7 @@ public class Link implements HistoryListener {
|
||||
|
||||
else if (token.matches("^dashboard,\\d+$")) {
|
||||
final String id = token.substring("dashboard,".length());
|
||||
return new MineScreen(new Account.Id(Integer.parseInt(id)));
|
||||
return new AccountDashboardScreen(new Account.Id(Integer.parseInt(id)));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -15,31 +15,32 @@
|
||||
package com.google.gerrit.client.changes;
|
||||
|
||||
import com.google.gerrit.client.data.AccountDashboardInfo;
|
||||
import com.google.gerrit.client.data.AccountInfo;
|
||||
import com.google.gerrit.client.reviewdb.Account;
|
||||
import com.google.gerrit.client.ui.AccountScreen;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
public class MineScreen extends AccountScreen {
|
||||
public class AccountDashboardScreen extends AccountScreen {
|
||||
private Account.Id ownerId;
|
||||
private ChangeTable table;
|
||||
private ChangeTable.Section byOwner;
|
||||
private ChangeTable.Section forReview;
|
||||
private ChangeTable.Section closed;
|
||||
|
||||
public MineScreen() {
|
||||
public AccountDashboardScreen() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public MineScreen(final Account.Id id) {
|
||||
super(Util.C.mineHeading());
|
||||
public AccountDashboardScreen(final Account.Id id) {
|
||||
super("");
|
||||
|
||||
ownerId = id;
|
||||
table = new ChangeTable();
|
||||
byOwner = new ChangeTable.Section(Util.C.mineByMe());
|
||||
forReview = new ChangeTable.Section(Util.C.mineForReview());
|
||||
closed = new ChangeTable.Section(Util.C.mineClosed());
|
||||
byOwner = new ChangeTable.Section("");
|
||||
forReview = new ChangeTable.Section("");
|
||||
closed = new ChangeTable.Section("");
|
||||
|
||||
table.addSection(byOwner);
|
||||
table.addSection(forReview);
|
||||
@@ -54,9 +55,7 @@ public class MineScreen extends AccountScreen {
|
||||
Util.LIST_SVC.forAccount(ownerId,
|
||||
new AsyncCallback<AccountDashboardInfo>() {
|
||||
public void onSuccess(final AccountDashboardInfo r) {
|
||||
byOwner.display(r.getByOwner());
|
||||
forReview.display(r.getForReview());
|
||||
closed.display(r.getClosed());
|
||||
display(r);
|
||||
}
|
||||
|
||||
public void onFailure(final Throwable caught) {
|
||||
@@ -64,4 +63,17 @@ public class MineScreen extends AccountScreen {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void display(final AccountDashboardInfo r) {
|
||||
final AccountInfo o = r.getOwner();
|
||||
|
||||
setTitleText(Util.M.accountDashboardTitle(o.getFullName()));
|
||||
byOwner.setTitleText(Util.M.changesUploadedBy(o.getFullName()));
|
||||
forReview.setTitleText(Util.M.changesReviewableBy(o.getFullName()));
|
||||
closed.setTitleText(Util.C.changesRecentlyClosed());
|
||||
|
||||
byOwner.display(r.getByOwner());
|
||||
forReview.display(r.getForReview());
|
||||
closed.display(r.getClosed());
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,7 @@ package com.google.gerrit.client.changes;
|
||||
import com.google.gwt.i18n.client.Constants;
|
||||
|
||||
public interface ChangeConstants extends Constants {
|
||||
String mineHeading();
|
||||
String mineByMe();
|
||||
String mineForReview();
|
||||
String mineClosed();
|
||||
String changesRecentlyClosed();
|
||||
|
||||
String starredHeading();
|
||||
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
leftMenuCodeReviews = Code Reviews
|
||||
menuMyChanges = My Changes
|
||||
menuMyUnclaimedChanges = Unclaimed Changes
|
||||
menuAllUnclaimedChanges = All Unclaimed Changes
|
||||
menuAllRecentChanges = Recent Changes
|
||||
menuMyStarredChanges = Starred Changes
|
||||
|
||||
leftMenuAdmin = Admin
|
||||
menuPeople = People
|
||||
menuGroups = Groups
|
||||
menuProjects = Projects
|
||||
|
||||
mineHeading = Changes for me
|
||||
mineByMe = Changes uploaded by me
|
||||
mineForReview = Changes reviewable by me
|
||||
mineClosed = Recently closed changes
|
||||
|
||||
starredHeading = Starred Changes
|
||||
changesRecentlyClosed = Recently closed changes
|
||||
|
||||
changeTableColumnID = ID
|
||||
changeTableColumnSubject = Subject
|
||||
@@ -24,4 +8,3 @@ changeTableColumnReviewers = Reviewers
|
||||
changeTableColumnProject = Project
|
||||
changeTableColumnLastUpdate = LastUpdate
|
||||
changeTableNone = (None)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2008 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.client.changes;
|
||||
|
||||
import com.google.gwt.i18n.client.Messages;
|
||||
|
||||
public interface ChangeMessages extends Messages {
|
||||
String accountDashboardTitle(String fullName);
|
||||
String changesUploadedBy(String fullName);
|
||||
String changesReviewableBy(String fullName);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
accountDashboardTitle = Changes for {0}
|
||||
changesUploadedBy = Changes uploaded by {0}
|
||||
changesReviewableBy = Changes reviewable by {0}
|
||||
@@ -16,6 +16,7 @@ package com.google.gerrit.client.changes;
|
||||
|
||||
import com.google.gerrit.client.Link;
|
||||
import com.google.gerrit.client.data.ChangeInfo;
|
||||
import com.google.gerrit.client.reviewdb.Change;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.Hyperlink;
|
||||
|
||||
@@ -68,7 +69,7 @@ public class ChangeTable extends FlexTable {
|
||||
setWidget(row, C_ID, new ChangeLink(String.valueOf(c.getId().get()), c));
|
||||
|
||||
String s = c.getSubject();
|
||||
if (c.getStatus() != null) {
|
||||
if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) {
|
||||
s += " (" + c.getStatus().name() + ")";
|
||||
}
|
||||
setWidget(row, C_SUBJECT, new ChangeLink(s, c));
|
||||
@@ -133,7 +134,7 @@ public class ChangeTable extends FlexTable {
|
||||
String titleText;
|
||||
|
||||
ChangeTable table;
|
||||
int titleRow;
|
||||
int titleRow = -1;
|
||||
int dataBegin;
|
||||
int rows;
|
||||
|
||||
@@ -142,7 +143,14 @@ public class ChangeTable extends FlexTable {
|
||||
}
|
||||
|
||||
public Section(final String titleText) {
|
||||
this.titleText = titleText;
|
||||
setTitleText(titleText);
|
||||
}
|
||||
|
||||
public void setTitleText(final String text) {
|
||||
titleText = text;
|
||||
if (titleRow >= 0) {
|
||||
table.setText(titleRow, 0, titleText);
|
||||
}
|
||||
}
|
||||
|
||||
public void display(final List<ChangeInfo> changeList) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||
|
||||
public class Util {
|
||||
public static final ChangeConstants C = GWT.create(ChangeConstants.class);
|
||||
public static final ChangeMessages M = GWT.create(ChangeMessages.class);
|
||||
|
||||
public static final ChangeListService LIST_SVC;
|
||||
|
||||
|
||||
@@ -21,13 +21,19 @@ import com.google.gwt.user.client.ui.FlowPanel;
|
||||
|
||||
public class Screen extends FlowPanel {
|
||||
private boolean requiresSignIn;
|
||||
private Element headerElem;
|
||||
|
||||
public Screen(final String heading) {
|
||||
public Screen(final String headingText) {
|
||||
setStyleName("gerrit-Screen");
|
||||
|
||||
final Element h = DOM.createElement("h1");
|
||||
DOM.setInnerText(h, heading);
|
||||
DOM.appendChild(getElement(), h);
|
||||
headerElem = DOM.createElement("h1");
|
||||
DOM.appendChild(getElement(), headerElem);
|
||||
|
||||
setTitleText(headingText);
|
||||
}
|
||||
|
||||
public void setTitleText(final String text) {
|
||||
DOM.setInnerText(headerElem, text);
|
||||
}
|
||||
|
||||
/** Set whether or not {@link Gerrit#isSignedIn()} must be true. */
|
||||
|
||||
Reference in New Issue
Block a user