mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-07 04:18:26 +02:00
Matched html style of plugin tabs
Resolves oddities related to the style of the plugin tabs on /server page - old style was being applied.
This commit is contained in:
parent
4b1b7f78c3
commit
415ac58c1a
@ -73,7 +73,7 @@ public enum Html {
|
||||
|
||||
ROW("<div class=\"row\">${0}</div>"),
|
||||
CARD("<div class=\"card\">${0}</div>"),
|
||||
BODY("<div class=\"body\">${0}</div>"),
|
||||
BODY("<div class=\"card-body\">${0}</div>"),
|
||||
PANEL("<div class=\"panel panel-default\">${0}</div>"),
|
||||
PANEL_BODY("<div class=\"panel-body\">${0}</div>"),
|
||||
HELP_BUBBLE("<div class=\"col-xs-6 col-sm-6 col-lg-6\"><a href=\"javascript:void(0)\" class=\"help material-icons pull-right\" data-trigger=\"focus\" data-toggle=\"popover\" data-placement=\"left\" data-container=\"body\" data-html=\"true\" data-original-title=\"${0}\" data-content=\"${1}\">help_outline</a></div>"),
|
||||
|
@ -28,6 +28,7 @@ import com.djrapitops.plan.utilities.formatting.Formatter;
|
||||
import com.djrapitops.plan.utilities.formatting.Formatters;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import com.djrapitops.plan.utilities.html.structure.NavLink;
|
||||
import com.djrapitops.plan.utilities.html.structure.TabsElement;
|
||||
|
||||
import java.util.*;
|
||||
@ -89,12 +90,12 @@ public class AnalysisPluginTabs {
|
||||
|
||||
private void generate() {
|
||||
if (serverData.isEmpty()) {
|
||||
nav = "<li><a class=\"nav-button\" href=\"javascript:void(0)\">Extensions (No Data)</a></li>";
|
||||
nav = new NavLink(Icon.called("cubes").build(), "Overview (No Data)").toHtml();
|
||||
tab = "<div class=\"tab\"><div class=\"row clearfix\">" +
|
||||
"<div class=\"col-md-12\">" + Html.CARD.parse("<div class=\"body\"><p>No Extension Data</p></div>") +
|
||||
"<div class=\"col-md-12\">" + Html.CARD.parse("<div class=\"card-body\"><p>No Extension Data</p></div>") +
|
||||
"</div></div></div>";
|
||||
} else {
|
||||
nav = "<li><a class=\"nav-button\" href=\"javascript:void(0)\">General</a></li>";
|
||||
nav = new NavLink(Icon.called("cubes").build(), "Overview").toHtml();
|
||||
tab = generatePageTab();
|
||||
}
|
||||
}
|
||||
@ -126,7 +127,18 @@ public class AnalysisPluginTabs {
|
||||
}
|
||||
|
||||
private String wrapInTab(String content) {
|
||||
return "<div class=\"tab\"><div class=\"row clearfix\">" + content + "</div></div>";
|
||||
return "<div class=\"tab\"><div class=\"container-fluid mt-4\">" +
|
||||
// Page heading
|
||||
"<div class=\"d-sm-flex align-items-center justify-content-between mb-4\">" +
|
||||
"<h1 class=\"h3 mb-0 text-gray-800\"><i class=\"sidebar-toggler fa fa-fw fa-bars\"></i>Server name · Plugins Overview</h1>" +
|
||||
"<a href=\"network.html\" class=\"btn bg-plan btn-icon-split\">" +
|
||||
"<span class=\"icon text-white-50\">" +
|
||||
"<i class=\"fas fa-fw fa-arrow-left\"></i><i class=\"fas fa-fw fa-cloud\"></i>" +
|
||||
"</span>" +
|
||||
"<span class=\"text\">Network page</span>" +
|
||||
"</a></div>" +
|
||||
// End Page heading
|
||||
"<div class=\"row clearfix\">" + content + "</div></div></div>";
|
||||
}
|
||||
|
||||
private TabsElement.Tab wrapToTabElementTab(ExtensionTabData tabData) {
|
||||
@ -197,14 +209,14 @@ public class AnalysisPluginTabs {
|
||||
builder.append("<p>");
|
||||
}
|
||||
builder.append(Icon.fromExtensionIcon(descriptive.getIcon()))
|
||||
.append(' ').append(descriptive.getText()).append(": ").append(formattedValue).append("</p>");
|
||||
.append(' ').append(descriptive.getText()).append("<span class=\"float-right\"><b>").append(formattedValue).append("</b></span></p>");
|
||||
}
|
||||
|
||||
private String wrapInContainer(ExtensionInformation information, String tabsElement) {
|
||||
String colWidth = hasWideTable ? "col-md-8 col-lg-8" : "col-md-4 col-lg-4";
|
||||
return "<div class=\"col-xs-12 col-sm-12 " + colWidth + "\"><div class=\"card\">" +
|
||||
"<div class=\"header\">" +
|
||||
"<h2>" + Icon.fromExtensionIcon(information.getIcon()) + ' ' + information.getPluginName() + "</h2>" +
|
||||
String colWidth = hasWideTable ? "col-md-8 col-lg-8 col-sm-12" : "col-md-4 col-lg-4 col-sm-12";
|
||||
return "<div class=\"col-xs-12 col-sm-12 " + colWidth + "\"><div class=\"card shadow mb-0\">" +
|
||||
"<div class=\"card-header py-3\">" +
|
||||
"<h6 class=\"m-0 font-weight-bold col-black\">" + Icon.fromExtensionIcon(information.getIcon()) + ' ' + information.getPluginName() + "</h6>" +
|
||||
"</div>" +
|
||||
tabsElement +
|
||||
"</div></div>";
|
||||
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.plan.utilities.html.structure;
|
||||
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
|
||||
/**
|
||||
* Html utility for creating navigation link html.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class NavLink {
|
||||
|
||||
private final Icon icon;
|
||||
private final String tabName;
|
||||
|
||||
public NavLink(Icon icon, String tabName) {
|
||||
this.icon = icon;
|
||||
this.tabName = tabName;
|
||||
}
|
||||
|
||||
public String toHtml() {
|
||||
return "<li class=\"nav-item nav-button\">" +
|
||||
"<a class=\"nav-link\" href=\"javascript:void(0)\">" +
|
||||
icon.toHtml() +
|
||||
"<span>" + tabName + "</span></a>" +
|
||||
"</li>";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user