change devDependency html linter to resolve audit issue, fix lint issues
[websub-hub] / src / template / template-helper.js
index f891e4fe65949633d7326d0dd644b9e85510fb52..2da05dfb928007fa1f080bb35c7ab4770262d9f2 100644 (file)
@@ -73,7 +73,7 @@ function renderSubscriptionRow(subscription) {
 </tr>`;
   }
   return `<tr>
-  <td scope="row">${subscription.callback}</td>
+  <td>${subscription.callback}</td>
   <td>${TemplateHelper.dateFormat(subscription.created, Message.EndOfTime, Message.BeginningOfTime, Message.Unknown)}</td>
   <td>${TemplateHelper.dateFormat(subscription.verified, Message.EndOfTime, Message.Never, Message.Never)}</td>
   <td>${TemplateHelper.dateFormat(subscription.expires, Message.Never, Message.BeginningOfTime, Message.Never)}</td>
@@ -134,10 +134,33 @@ function xmlEscape(string) {
   }[c]));
 }
 
+
+/**
+ * Add common site links to navigation header.
+ * @param {number} pagePathLevel depth from root
+ * @param {object} ctx context
+ * @param {object} options options
+ */
+function navLinks(pagePathLevel, ctx, options) {
+  if (!options.navLinks) {
+    options.navLinks = [];
+  }
+  const rootPath = '../'.repeat(pagePathLevel);
+
+  if (options.pageIdentifier !== 'admin') {
+    options.navLinks.push({
+      text: 'Admin',
+      href: `${rootPath}admin/`,
+    });
+  }
+}
+
+
 module.exports = Object.assign(Object.create(TemplateHelper), {
+  navLinks,
   xmlEscape,
   renderTopicRowHeader,
   renderTopicRow,
   renderSubscriptionRowHeader,
   renderSubscriptionRow,
-});
\ No newline at end of file
+});