Handle internal extension menu items like built in items
If the URL starts with "#" and the target window is null or the empty
string it is reasonable to assume the menu item was registered to be
handled in this GWT application session.
Use LinkMenuItem like the other internal core menus to pass the
history token into the dispatcher. Plugins can contribute screens
using "#/x/${plugin}/" namespace so it is very reasonable to see
additional links of this format.
Change-Id: Ie2505bdc6ba6b4a318de0564ed05d40ee96fa026
This commit is contained in:
@@ -899,15 +899,26 @@ public class Gerrit implements EntryPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addExtensionLink(LinkMenuBar m, TopMenuItem item) {
|
private static void addExtensionLink(LinkMenuBar m, TopMenuItem item) {
|
||||||
Anchor atag = anchor(item.getName(), isAbsolute(item.getUrl())
|
if (item.getUrl().startsWith("#")
|
||||||
? item.getUrl()
|
&& (item.getTarget() == null || item.getTarget().isEmpty())) {
|
||||||
: selfRedirect(item.getUrl()));
|
LinkMenuItem a =
|
||||||
|
new LinkMenuItem(item.getName(), item.getUrl().substring(1));
|
||||||
atag.setTarget(item.getTarget());
|
if (item.getId() != null) {
|
||||||
if (item.getId() != null) {
|
a.getElement().setAttribute("id", item.getId());
|
||||||
atag.getElement().setAttribute("id", item.getId());
|
}
|
||||||
|
m.add(a);
|
||||||
|
} else {
|
||||||
|
Anchor atag = anchor(item.getName(), isAbsolute(item.getUrl())
|
||||||
|
? item.getUrl()
|
||||||
|
: selfRedirect(item.getUrl()));
|
||||||
|
if (item.getTarget() != null && !item.getTarget().isEmpty()) {
|
||||||
|
atag.setTarget(item.getTarget());
|
||||||
|
}
|
||||||
|
if (item.getId() != null) {
|
||||||
|
atag.getElement().setAttribute("id", item.getId());
|
||||||
|
}
|
||||||
|
m.add(atag);
|
||||||
}
|
}
|
||||||
m.add(atag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isAbsolute(String url) {
|
private static boolean isAbsolute(String url) {
|
||||||
|
|||||||
Reference in New Issue
Block a user