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) {
|
||||
Anchor atag = anchor(item.getName(), isAbsolute(item.getUrl())
|
||||
? item.getUrl()
|
||||
: selfRedirect(item.getUrl()));
|
||||
|
||||
atag.setTarget(item.getTarget());
|
||||
if (item.getId() != null) {
|
||||
atag.getElement().setAttribute("id", item.getId());
|
||||
if (item.getUrl().startsWith("#")
|
||||
&& (item.getTarget() == null || item.getTarget().isEmpty())) {
|
||||
LinkMenuItem a =
|
||||
new LinkMenuItem(item.getName(), item.getUrl().substring(1));
|
||||
if (item.getId() != null) {
|
||||
a.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) {
|
||||
|
Reference in New Issue
Block a user