diff options
| -rw-r--r-- | app/routes/special/router.ts | 24 | ||||
| -rw-r--r-- | static/css/globalstyles.css | 6 | ||||
| -rw-r--r-- | views/page.ejs | 2 | ||||
| -rw-r--r-- | views/pageinfo.ejs | 83 | ||||
| -rw-r--r-- | views/purge.ejs | 2 |
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> |
