X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=src%2Ftemplate%2Fadmin-overview-html.js;h=948bdbb0083fa77917a7f5b96dc61eb94557be92;hb=3ca7fccb306d0b23626befc3791ffa360b3db1e7;hp=525337dc5ad6e76b3591d6d6297717009cc0d1e4;hpb=3bc885c4b6ef8e5ced2ee9708194523a41ebfe7a;p=websub-hub diff --git a/src/template/admin-overview-html.js b/src/template/admin-overview-html.js index 525337d..948bdbb 100644 --- a/src/template/admin-overview-html.js +++ b/src/template/admin-overview-html.js @@ -1,17 +1,19 @@ 'use strict'; const th = require('./template-helper'); +const { sessionNavLinks } = require('@squeep/authentication-module'); /** * Show a summary of all topics. - * @param {Object} ctx - * @param {Object[]} ctx.topics - * @param {Object} options - * @param {Object} options.manager - * @param {String} options.manager.pageTitle - * @returns {String} + * @param {object} ctx context + * @param {object[]} ctx.topics topics + * @param {object} options options + * @param {object} options.manager manager options + * @param {string} options.manager.pageTitle page title + * @returns {string} html */ module.exports = (ctx, options) => { + const pagePathLevel = 1; const pageTitle = `${options.manager.pageTitle} - Topics`; const logoUrl = options.manager.logoUrl; const footerEntries = options.manager.footerEntries; @@ -20,13 +22,15 @@ module.exports = (ctx, options) => { } const htmlOptions = { + pageIdentifier: 'admin', pageTitle, logoUrl, footerEntries, }; + th.navLinks(pagePathLevel, ctx, htmlOptions); + sessionNavLinks(pagePathLevel, ctx, htmlOptions); const content = [ - '', // This fixes a layout rendering flash on load in FF; do not know why this works but it does. `

${ctx.topics.length ? ctx.topics.length : 'no'} topic${(ctx.topics.length === 1) ? '' : 's'}

@@ -34,11 +38,11 @@ module.exports = (ctx, options) => { th.renderTopicRowHeader(), ` `, - ...(ctx.topics && ctx.topics.map((topic) => th.renderTopicRow(topic, { length: topic.subscribers }))), + ...((ctx?.topics || []).map((topic) => th.renderTopicRow(topic, { length: topic.subscribers }))), `
`, ]; - return th.htmlPage(1, ctx, htmlOptions, content); + return th.htmlPage(pagePathLevel, ctx, htmlOptions, content); }; \ No newline at end of file