Move ejs templates to views/

Move the ejs templates to the default Express.js views/ folder and
change their extension to .ejs.  Reconfigure Express.js to look for
templates in the views folders as well as the plugins folder.  This
enables plugins to render templates using paths of following format
"pluginName/path/to/page-or-view".
This commit is contained in:
Hornwitser committed 2019-09-18 16:54:11 +02:00
1 parent a4983d75fb
commit a62e8d17a3
12 files changed
+27 -28

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
<nav class="navbar nav-pills nav-fill">
<div class="nav-item col-3">
<a class="navbar-brand border-0" href="/">
<img src="/pictures/logo.png" width="50" height="50" class="d-inline-block align-middle " alt=""/>
<h3 class=" ml-3 nav-title">Clusterio</h3>
</a>
</div>
<div class="nav-item mr-1">
<a class="nav-link align-middle" href="/">Storage</a>
</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){
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();
}
}
}
}
%>
<%- sidebarPluginButtonsHtml %>
<div class="nav-item">
<a class="nav-link align-middle" href="/settings">Settings</a>
</div>
</nav>