aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLMBishop <13875753+LMBishop@users.noreply.github.com>2021-12-23 00:16:09 +0000
committerLMBishop <13875753+LMBishop@users.noreply.github.com>2021-12-23 00:16:09 +0000
commit1b433819cbfc084836ee05e338d06f159e77a3d1 (patch)
tree3edd19947d3514b07ef4a761998dbfe86c02ce54
parent58b50e0c90a51d5d1c8801e8d9e63bdf5d07a468 (diff)
Add page info page
-rw-r--r--app/routes/special/router.ts24
-rw-r--r--static/css/globalstyles.css6
-rw-r--r--views/page.ejs2
-rw-r--r--views/pageinfo.ejs83
-rw-r--r--views/purge.ejs2
5 files changed, 116 insertions, 1 deletions
diff --git a/app/routes/special/router.ts b/app/routes/special/router.ts
index 26130c5..2015a35 100644
--- a/app/routes/special/router.ts
+++ b/app/routes/special/router.ts
@@ -39,6 +39,30 @@ router.get('/special/purge/:page/confirm', (req, res, next) => {
}
});
+router.use('/special/info/:page?', page);
+
+router.get('/special/info/:page?', navbar, (req, res, next) => {
+ const page = res.locals.page;
+
+ if (!page) {
+ next();
+ return;
+ }
+
+ res.render('pageinfo.ejs', {
+ navbar: res.locals.navbarHtml,
+ standardName: page.standardName,
+ displayTitle: page.metadata.displayTitle,
+ buildTime: page.buildTime,
+ primary: page.metadata.includeInNavbar,
+ showTitle: page.metadata.showTitle,
+ sortOrder: page.metadata.sortOrder,
+ dependencies: page.metadata.dependencies,
+ dependents: page.metadata.dependents,
+ errors: page.metadata.errors,
+ });
+});
+
router.get('/special/rebuild', navbar, (req, res) => {
res.render('rebuild.ejs', {
navbar: res.locals.navbarHtml
diff --git a/static/css/globalstyles.css b/static/css/globalstyles.css
index 6826ab9..1f22f5e 100644
--- a/static/css/globalstyles.css
+++ b/static/css/globalstyles.css
@@ -105,3 +105,9 @@ a {
padding: 10px;
background-color: rgba(255, 0, 0, 0.2);
}
+
+table, th, td {
+ border: 1px solid rgb(200, 200, 200);
+ border-collapse: collapse;
+ padding: 10px;
+}
diff --git a/views/page.ejs b/views/page.ejs
index 41ee1e2..2bd4262 100644
--- a/views/page.ejs
+++ b/views/page.ejs
@@ -12,7 +12,7 @@
<div id="content">
<%- content %>
<hr>
- <span class=footer><a href="https://github.com/LMBishop/website">GitHub</a> | <a href="/<%= path %>.wiki">View raw</a> | Page built: <%= buildTime %> | <a href="/special/purge/<%= path %>">Purge this page</a></span>
+ <span class=footer><a href="https://github.com/LMBishop/website">GitHub</a> | <a href="/<%= path %>.wiki">View raw</a> | Page built: <%= buildTime %> | <a href="/special/info/<%= path %>">Page info</a></span>
</div>
</div>
</div>
diff --git a/views/pageinfo.ejs b/views/pageinfo.ejs
new file mode 100644
index 0000000..c0ba59d
--- /dev/null
+++ b/views/pageinfo.ejs
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Page information for <%= standardName %></title>
+ <link rel="stylesheet" href="/css/globalstyles.css">
+</head>
+<body>
+ <div id="main-container">
+ <%- include('partials/header') %>
+ <div id="content-container">
+ <%- include('partials/navbar') %>
+ <div id="content">
+ <h1>Information for page <%= standardName %></h1>
+ <table>
+ <tr>
+ <td>Standard name</td>
+ <td><%= standardName %></td>
+ </tr>
+ <tr>
+ <td>Display title</td>
+ <td><%= displayTitle ?? '-' %></td>
+ </tr>
+ <tr>
+ <td>Last build</td>
+ <td><%- (buildTime != 0) ? new Date(buildTime) : '-' %></td>
+ </tr>
+ <tr>
+ <td>Primary</td>
+ <td><%= primary ?? false %></td>
+ </tr>
+ <tr>
+ <td>Show title</td>
+ <td><%= showTitle ?? false %></td>
+ </tr>
+ <tr>
+ <td>Sort order</td>
+ <td><%- sortOrder ?? '-' %></td>
+ </tr>
+ <tr>
+ <td>Dependencies</td>
+ <td>
+ <% if (dependencies.size === 0) { %>
+ <%- '-' %>
+ <% } else { %>
+ <% dependencies.forEach(e => { %>
+ <%- `${e}<br>` %>
+ <% }); %>
+ <%}%>
+ </td>
+ </tr>
+ <tr>
+ <td>Pages which depend on this page</td>
+ <td>
+ <% if (dependents.size === 0) { %>
+ <%- '-' %>
+ <% } else { %>
+ <% dependents.forEach(e => { %>
+ <%- `${e}<br>` %>
+ <% }); %>
+ <%}%>
+ </td>
+ </tr>
+ <tr>
+ <td>Errors</td>
+ <td>
+ <% if (errors.length === 0) { %>
+ <%- '-' %>
+ <% } else { %>
+ <% errors.forEach(e => { %>
+ <%- `${e.identifier}: ${e.message}<br>` %>
+ <% }); %>
+ <%}%>
+ </td>
+ </tr>
+ </table>
+ <p><a href="/special/purge/<%= standardName %>">Purge this page?</a></p>
+ <hr>
+ <span class=footer><a href="https://github.com/LMBishop/website">GitHub</a> | <a href="/<%= path %>">View original</a></span>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/views/purge.ejs b/views/purge.ejs
index 04bae61..df48073 100644
--- a/views/purge.ejs
+++ b/views/purge.ejs
@@ -17,6 +17,8 @@
<p>Are you sure you wish to purge the page <span class="highlight"><%= page %></span>?</p>
<p>The last build time for this page was <span class="highlight"><%= buildTime %></span> (<span class="highlight"><%= buildTimeRelative %></span> minutes ago).</p>
<button id="confirm" data-page="<%= page %>">Confirm</button>
+ <hr>
+ <span class=footer><a href="https://github.com/LMBishop/website">GitHub</a> | <a href="/<%= page %>">View original</a></span>
</div>
</div>
</div>