Fixed ${navPluginsTabs} getting replaced with a locale

- Makes plugin tabs accessible again when using locale
- Fixed players.html and error.html for the new sb-admin-2.js behavior
  (tabs need id)

Affects issues:
- Fixed #1409
This commit is contained in:
Risto Lahtela 2020-05-07 11:16:26 +03:00
parent 6b4db32244
commit a6b98e658e
9 changed files with 17 additions and 21 deletions

View File

@ -116,8 +116,8 @@ public class NetworkPage implements Page {
return UnaryChain.of(templateHtml)
.chain(theme::replaceThemeColors)
.chain(placeholders::apply)
.chain(locale::replaceLanguageInHtml)
.chain(pluginPlaceholders::apply)
.chain(locale::replaceLanguageInHtml)
.apply();
}
}

View File

@ -28,6 +28,7 @@ import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.locale.Locale;
import com.djrapitops.plan.settings.theme.Theme;
import com.djrapitops.plan.settings.theme.ThemeVal;
import com.djrapitops.plan.utilities.java.UnaryChain;
import com.djrapitops.plan.version.VersionChecker;
import java.util.UUID;
@ -104,16 +105,19 @@ public class PlayerPage implements Page {
placeholders.put("contributors", Contributors.generateContributorHtml());
String html = locale.replaceLanguageInHtml(placeholders.apply(templateHtml));
placeholders = new PlaceholderReplacer();
PlaceholderReplacer pluginPlaceholders = new PlaceholderReplacer();
PlayerPluginTab pluginTabs = pageFactory.inspectPluginTabs(playerUUID);
placeholders.put("playerName", playerName);
placeholders.put("backButton", (serverInfo.getServer().isProxy() ? Html.BACK_BUTTON_NETWORK : Html.BACK_BUTTON_SERVER).create());
placeholders.put("navPluginsTabs", pluginTabs.getNav());
placeholders.put("pluginsTabs", pluginTabs.getTab());
pluginPlaceholders.put("playerName", playerName);
pluginPlaceholders.put("backButton", (serverInfo.getServer().isProxy() ? Html.BACK_BUTTON_NETWORK : Html.BACK_BUTTON_SERVER).create());
pluginPlaceholders.put("navPluginsTabs", pluginTabs.getNav());
pluginPlaceholders.put("pluginsTabs", pluginTabs.getTab());
return placeholders.apply(theme.replaceThemeColors(html));
return UnaryChain.of(templateHtml)
.chain(theme::replaceThemeColors)
.chain(placeholders::apply)
.chain(pluginPlaceholders::apply)
.chain(locale::replaceLanguageInHtml)
.apply();
}
}

View File

@ -111,8 +111,8 @@ public class ServerPage implements Page {
return UnaryChain.of(templateHtml)
.chain(theme::replaceThemeColors)
.chain(placeholders::apply)
.chain(locale::replaceLanguageInHtml)
.chain(pluginPlaceholders::apply)
.chain(locale::replaceLanguageInHtml)
.apply();
}
}

View File

@ -71,7 +71,7 @@
<!-- Main Content -->
<div id="content" style="display: flex;">
<!-- Begin Player Overview Tab -->
<div class="tab" style="width: 100%;">
<div class="tab" id="information" style="width: 100%;">
<div class="container-fluid mt-4">
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">

View File

@ -1,6 +1,6 @@
const content = document.getElementById("content");
const navButtons = Array.from(document.getElementsByClassName("nav-button"));
const tabs = Array.from(document.getElementsByClassName("tab")).filter(tab => tab.id);
const tabs = Array.from(document.getElementsByClassName("tab")).filter(tab => tab.id); // TABS NEED IDS
const tabCount = tabs.length;
function openTab(openIndex) {

View File

@ -632,8 +632,6 @@
</div> <!-- End of Geolocations tab -->
<!-- Begin Plugins Overview Tab -->
${tabsPlugins}
<div class="tab"></div>
<div class="tab"></div>
</div> <!-- End of Main Content -->
</div>
<!-- End of Content Wrapper -->

View File

@ -550,10 +550,6 @@
</div> <!-- /.container-fluid -->
</div> <!-- End of Servers Overview Tab-->
${pluginsTabs}
<div class="tab"></div>
<div class="tab"></div>
<div class="tab"></div>
<div class="tab"></div>
</div> <!-- End of Main Content -->
</div>
<!-- End of Content Wrapper -->

View File

@ -71,7 +71,7 @@
<!-- Main Content -->
<div id="content" style="display: flex;">
<!-- Begin Player Overview Tab -->
<div class="tab" style="width: 100%;">
<div class="tab" id="players" style="width: 100%;">
<div class="container-fluid mt-4">
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">

View File

@ -1105,8 +1105,6 @@
</div> <!-- End of Performance tab -->
<!-- Begin Plugins Overview Tab -->
${tabsPlugins}
<div class="tab"></div>
<div class="tab"></div>
</div> <!-- End of Main Content -->
</div>
<!-- End of Content Wrapper -->