Use href="javascript;" for All {Side-by-Side,Unified} links
These links shouldn't have an anchor location. There is nothing for the browser to remember or visit if it were opened in a new tab for example. Worse the code that used to be here was wrong, you can't rely on History.getToken() to give you an accurate value as the UI for the next screen is being constructed while the current screen is still displayed. So the code was always sampling the old URL, not the URL for the change. Change-Id: I7e02d5a87e358eeecce05a35c42ce07f71db2058
This commit is contained in:
@@ -23,10 +23,10 @@ import com.google.gerrit.client.ui.NavigationTable;
|
|||||||
import com.google.gerrit.client.ui.PatchLink;
|
import com.google.gerrit.client.ui.PatchLink;
|
||||||
import com.google.gerrit.common.data.PatchSetDetail;
|
import com.google.gerrit.common.data.PatchSetDetail;
|
||||||
import com.google.gerrit.reviewdb.client.Patch;
|
import com.google.gerrit.reviewdb.client.Patch;
|
||||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
|
||||||
import com.google.gerrit.reviewdb.client.Patch.ChangeType;
|
import com.google.gerrit.reviewdb.client.Patch.ChangeType;
|
||||||
import com.google.gerrit.reviewdb.client.Patch.Key;
|
import com.google.gerrit.reviewdb.client.Patch.Key;
|
||||||
import com.google.gerrit.reviewdb.client.Patch.PatchType;
|
import com.google.gerrit.reviewdb.client.Patch.PatchType;
|
||||||
|
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
|
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
|
||||||
@@ -35,8 +35,8 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
|||||||
import com.google.gwt.event.dom.client.KeyCodes;
|
import com.google.gwt.event.dom.client.KeyCodes;
|
||||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.History;
|
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.ui.Anchor;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
||||||
@@ -436,32 +436,27 @@ public class PatchTable extends Composite {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initializeLastRow(int row) {
|
void initializeLastRow(int row) {
|
||||||
table.setWidget(
|
Anchor sideBySide = new Anchor(Util.C.buttonDiffAllSideBySide());
|
||||||
row,
|
sideBySide.addClickHandler(new ClickHandler() {
|
||||||
C_SIDEBYSIDE - 2,
|
@Override
|
||||||
new InlineHyperlink(Util.C.buttonDiffAllSideBySide(), History
|
public void onClick(ClickEvent event) {
|
||||||
.getToken()) {
|
for (Patch p : detail.getPatches()) {
|
||||||
@Override
|
openWindow(Dispatcher.toPatchSideBySide(base, p.getKey()));
|
||||||
public void go() {
|
}
|
||||||
for (Patch p : detail.getPatches()) {
|
}
|
||||||
openWindow(Dispatcher.toPatchSideBySide(base, p.getKey()));
|
});
|
||||||
}
|
table.setWidget(row, C_SIDEBYSIDE - 2, sideBySide);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
int C_UNIFIED = C_SIDEBYSIDE - 2 + 1;
|
int C_UNIFIED = C_SIDEBYSIDE - 2 + 1;
|
||||||
table.setWidget(
|
Anchor unified = new Anchor(Util.C.buttonDiffAllUnified());
|
||||||
row,
|
unified.addClickHandler(new ClickHandler() {
|
||||||
C_UNIFIED,
|
public void onClick(ClickEvent event) {
|
||||||
new InlineHyperlink(Util.C.buttonDiffAllUnified(), History
|
for (Patch p : detail.getPatches()) {
|
||||||
.getToken()) {
|
openWindow(Dispatcher.toPatchUnified(base, p.getKey()));
|
||||||
@Override
|
}
|
||||||
public void go() {
|
};
|
||||||
for (Patch p : detail.getPatches()) {
|
});
|
||||||
openWindow(Dispatcher.toPatchUnified(base, p.getKey()));
|
table.setWidget(row, C_UNIFIED, unified);
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openWindow(String token) {
|
private void openWindow(String token) {
|
||||||
|
|||||||
Reference in New Issue
Block a user