mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-15 23:25:16 +01: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("4drian3d", LANG),
|
||||||
new Contributor("\u6d1b\u4f0a", LANG),
|
new Contributor("\u6d1b\u4f0a", LANG),
|
||||||
new Contributor("portlek", CODE),
|
new Contributor("portlek", CODE),
|
||||||
new Contributor("mbax", CODE)
|
new Contributor("mbax", CODE),
|
||||||
|
new Contributor("rymiel", CODE)
|
||||||
};
|
};
|
||||||
|
|
||||||
private Contributors() {
|
private Contributors() {
|
||||||
|
@ -26,9 +26,11 @@ import org.apache.commons.lang3.RegExUtils;
|
|||||||
*/
|
*/
|
||||||
public class TabsElement {
|
public class TabsElement {
|
||||||
|
|
||||||
|
private final int pluginId;
|
||||||
private final Tab[] tabs;
|
private final Tab[] tabs;
|
||||||
|
|
||||||
public TabsElement(Tab... tabs) {
|
public TabsElement(int pluginId, Tab... tabs) {
|
||||||
|
this.pluginId = pluginId;
|
||||||
this.tabs = tabs;
|
this.tabs = tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +47,7 @@ public class TabsElement {
|
|||||||
content.append("<div class=\"tab-content\">");
|
content.append("<div class=\"tab-content\">");
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Tab tab : tabs) {
|
for (Tab tab : tabs) {
|
||||||
String id = tab.getId();
|
String id = tab.getId(pluginId);
|
||||||
String navHtml = tab.getNavHtml();
|
String navHtml = tab.getNavHtml();
|
||||||
String contentHtml = tab.getContentHtml();
|
String contentHtml = tab.getContentHtml();
|
||||||
|
|
||||||
@ -83,8 +85,8 @@ public class TabsElement {
|
|||||||
return contentHtml;
|
return contentHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId(int pluginId) {
|
||||||
return "tab_" + RegExUtils.removeAll(title, "[^a-zA-Z0-9]*").toLowerCase();
|
return "tab_" + pluginId + "_" + RegExUtils.removeAll(title, "[^a-zA-Z0-9]*").toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,7 @@ public class PlayerPluginTab implements Comparable<PlayerPluginTab> {
|
|||||||
tabsElement = buildContentHtml(genericTabData);
|
tabsElement = buildContentHtml(genericTabData);
|
||||||
} else {
|
} else {
|
||||||
tabsElement = new TabsElement(
|
tabsElement = new TabsElement(
|
||||||
|
datum.getPluginID(),
|
||||||
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
||||||
).toHtmlFull();
|
).toHtmlFull();
|
||||||
}
|
}
|
||||||
|
@ -112,6 +112,7 @@ public class ServerPluginTabs {
|
|||||||
tabsElement = buildContentHtml(genericTabData);
|
tabsElement = buildContentHtml(genericTabData);
|
||||||
} else {
|
} else {
|
||||||
tabsElement = new TabsElement(
|
tabsElement = new TabsElement(
|
||||||
|
datum.getPluginID(),
|
||||||
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
||||||
).toHtmlFull();
|
).toHtmlFull();
|
||||||
}
|
}
|
||||||
@ -137,6 +138,7 @@ public class ServerPluginTabs {
|
|||||||
tabsElement = buildContentHtml(genericTabData);
|
tabsElement = buildContentHtml(genericTabData);
|
||||||
} else {
|
} else {
|
||||||
tabsElement = new TabsElement(
|
tabsElement = new TabsElement(
|
||||||
|
datum.getPluginID(),
|
||||||
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
datum.getTabs().stream().map(this::wrapToTabElementTab).toArray(TabsElement.Tab[]::new)
|
||||||
).toHtmlFull();
|
).toHtmlFull();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user