948bdbb0083fa77917a7f5b96dc61eb94557be92
3 const th
= require('./template-helper');
4 const { sessionNavLinks
} = require('@squeep/authentication-module');
7 * Show a summary of all topics.
8 * @param {object} ctx context
9 * @param {object[]} ctx.topics topics
10 * @param {object} options options
11 * @param {object} options.manager manager options
12 * @param {string} options.manager.pageTitle page title
13 * @returns {string} html
15 module
.exports
= (ctx
, options
) => {
16 const pagePathLevel
= 1;
17 const pageTitle
= `${options.manager.pageTitle} - Topics`;
18 const logoUrl
= options
.manager
.logoUrl
;
19 const footerEntries
= options
.manager
.footerEntries
;
25 pageIdentifier: 'admin',
30 th
.navLinks(pagePathLevel
, ctx
, htmlOptions
);
31 sessionNavLinks(pagePathLevel
, ctx
, htmlOptions
);
34 ` <section class="topics">
35 <p>${ctx.topics.length ? ctx.topics.length : 'no'} topic${(ctx.topics.length === 1) ? '' : 's'}</p>
38 th
.renderTopicRowHeader(),
41 ...((ctx
?.topics
|| []).map((topic
) => th
.renderTopicRow(topic
, { length: topic
.subscribers
}))),
47 return th
.htmlPage(pagePathLevel
, ctx
, htmlOptions
, content
);