X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=src%2Ftemplate%2Fadmin-topic-details-html.js;h=b598313e1c098921719d711e660f85896506b792;hb=3ca7fccb306d0b23626befc3791ffa360b3db1e7;hp=2b9a1af7fb44400768ffa9e416084651a034c525;hpb=3bc885c4b6ef8e5ced2ee9708194523a41ebfe7a;p=websub-hub diff --git a/src/template/admin-topic-details-html.js b/src/template/admin-topic-details-html.js index 2b9a1af..b598313 100644 --- a/src/template/admin-topic-details-html.js +++ b/src/template/admin-topic-details-html.js @@ -1,18 +1,20 @@ 'use strict'; const th = require('./template-helper'); +const { sessionNavLinks } = require('@squeep/authentication-module'); /** * Show a topic with all of its subscribers. - * @param {Object} ctx - * @param {Object} ctx.topic - * @param {Object[]} ctx.subscriptions - * @param {Object} options - * @param {Object} options.manager - * @param {String} options.manager.pageTitle - * @returns {String} + * @param {object} ctx context + * @param {object} ctx.topic topic + * @param {object[]} ctx.subscriptions subscriptions + * @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 = 2; const pageTitle = `${options.manager.pageTitle} - Topic Details`; const logoUrl = options.manager.logoUrl; const navLinks = [ @@ -27,14 +29,16 @@ module.exports = (ctx, options) => { } const htmlOptions = { + pageIdentifier: 'admin', pageTitle, logoUrl, navLinks, 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. `
`, @@ -45,18 +49,29 @@ module.exports = (ctx, options) => { `
`, + `
+

Topic Publish History — ${ctx.publishCount} updates in the last ${ctx.publishSpan} days

+ +
`, `
-

${ctx.subscriptions.length ? ctx.subscriptions.length : 'no'} subscription${(ctx.subscriptions.length === 1) ? '' : 's'}

- +

${ctx.subscriptions.length ? ctx.subscriptions.length : 'no'} subscription${(ctx.subscriptions.length === 1) ? '' : 's'}

`, + ...(ctx.subscriptions.length && [` + + + ${ctx.subscriptionsDelivered} of ${ctx.subscriptions.length} (${Math.ceil(100 * ctx.subscriptions.length / ctx.subscriptionsDelivered)}%) + `] || []), + `
`, th.renderSubscriptionRowHeader(), ` `, - ...(ctx.subscriptions && ctx.subscriptions.map(th.renderSubscriptionRow)), + ...((ctx?.subscriptions || []).map(th.renderSubscriptionRow)), `
`, ]; - return th.htmlPage(2, ctx, htmlOptions, content); + return th.htmlPage(pagePathLevel, ctx, htmlOptions, content); }; \ No newline at end of file