mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-26 08:33:12 +09:00
Refactor EJS string gluing code
Rewrite awful string gluing of HTML with JS to use the slightly less awful EJS string gluing method.
This commit is contained in:
1 parent
706a1dbd39
commit
6726c2b16f
2 files changed
+59
-70
No files matched your search
+16
-19
@@ -10,27 +10,24 @@
|
||||
</div>
|
||||
<div class="nav-item mr-1">
|
||||
<a class="nav-link align-middle" href="/nodes">Slaves</a>
|
||||
</div>
|
||||
<%# Very ugly ejs code to hide the Players button if the playerManager plugin isn`t installed %>
|
||||
<%
|
||||
let sidebarPluginButtonsHtml = "";
|
||||
for(let o in locals.masterPlugins){
|
||||
</div><%
|
||||
for(let o in locals.masterPlugins) {
|
||||
let plug = locals.masterPlugins[o];
|
||||
if(plug.main
|
||||
&& plug.main.ui
|
||||
&& typeof plug.main.ui.sidebar == "object"
|
||||
&& Array.isArray(plug.main.ui.sidebar)){
|
||||
let sidebarEntries = plug.main.ui.sidebar;
|
||||
for(let i in sidebarEntries){
|
||||
let button = sidebarEntries[i];
|
||||
if(button.getHtml && typeof button.getHtml == "function"){
|
||||
sidebarPluginButtonsHtml += button.getHtml();
|
||||
if (
|
||||
plug.main
|
||||
&& plug.main.ui
|
||||
&& typeof plug.main.ui.sidebar == "object"
|
||||
&& Array.isArray(plug.main.ui.sidebar)
|
||||
) {
|
||||
let sidebarEntries = plug.main.ui.sidebar;
|
||||
for (let i in sidebarEntries) {
|
||||
let button = sidebarEntries[i];
|
||||
if (button.getHtml && typeof button.getHtml == "function") { %>
|
||||
<%- button.getHtml() %><%
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
<%- sidebarPluginButtonsHtml %>
|
||||
} %>
|
||||
<div class="nav-item">
|
||||
<a class="nav-link align-middle" href="/settings">Settings</a>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user