mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-27 14:02:38 +02:00
Use globally unique plugin ID for plugin cards with tabs (#1983)
Affects issues: - Fixed #1982
This commit is contained in:
parent
c4e5e3f1c7
commit
d265d5b586
@ -82,7 +82,8 @@ public class Contributors {
|
||||
new Contributor("4drian3d", LANG),
|
||||
new Contributor("\u6d1b\u4f0a", LANG),
|
||||
new Contributor("portlek", CODE),
|
||||
new Contributor("mbax", CODE)
|
||||
new Contributor("mbax", CODE),
|
||||
new Contributor("rymiel", CODE)
|
||||
};
|
||||
|
||||
private Contributors() {
|
||||
|
@ -26,9 +26,11 @@ import org.apache.commons.lang3.RegExUtils;
|
||||
*/
|
||||
public class TabsElement {
|
||||
|
||||
private final int pluginId;
|
||||
private final Tab[] tabs;
|
||||
|
||||
public TabsElement(Tab... tabs) {
|
||||
public TabsElement(int pluginId, Tab... tabs) {
|
||||
this.pluginId = pluginId;
|
||||
this.tabs = tabs;
|
||||
}
|
||||
|
||||
@ -45,7 +47,7 @@ public class TabsElement {
|
||||
content.append("<div class=\"tab-content\">");
|
||||
boolean first = true;
|
||||
for (Tab tab : tabs) {
|
||||
String id = tab.getId();
|
||||
String id = tab.getId(pluginId);
|
||||
String navHtml = tab.getNavHtml();
|
||||
String contentHtml = tab.getContentHtml();
|
||||
|
||||
@ -83,8 +85,8 @@ public class TabsElement {
|
||||
return contentHtml;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return "tab_" + RegExUtils.removeAll(title, "[^a-zA-Z0-9]*").toLowerCase();
|
||||
public String getId(int pluginId) {
|
||||
return "tab_" + pluginId + "_" + RegExUtils.removeAll(title, "[^a-zA-Z0-9]*").toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ public class PlayerPluginTab implements Comparable<PlayerPluginTab> {
|
||||
tabsElement = buildContentHtml(genericTabData);
|
||||
} else {
|
||||
tabsElement = new TabsElement(
|
||||
datum.getPluginID(),
|
||||
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
||||
).toHtmlFull();
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ public class ServerPluginTabs {
|
||||
tabsElement = buildContentHtml(genericTabData);
|
||||
} else {
|
||||
tabsElement = new TabsElement(
|
||||
datum.getPluginID(),
|
||||
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
||||
).toHtmlFull();
|
||||
}
|
||||
@ -137,6 +138,7 @@ public class ServerPluginTabs {
|
||||
tabsElement = buildContentHtml(genericTabData);
|
||||
} else {
|
||||
tabsElement = new TabsElement(
|
||||
datum.getPluginID(),
|
||||
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
||||
).toHtmlFull();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user