7baaa417b02938a08b000ff947b75fa24d414f23
[squeep-indie-auther] / src / template / root-html.js
1 'use strict';
2
3 const th = require('./template-helper');
4
5 function aboutSection() {
6 return `
7 <section class="about">
8 <h2>What</h2>
9 <p>
10 This is an <a class="external" href="https://indieweb.org/IndieAuth">IndieAuth</a> service.
11 </p>
12 <p>
13 It facilitates distributed authentication.
14 </p>
15 <p>
16 If you are not an established user of this service, or some sort of web application, there is very little here for you.
17 </p>
18 </section>`;
19 }
20
21 function contactSection(contactHTML) {
22 let section = '';
23 if (contactHTML) {
24 section = ` <section>
25 ${contactHTML}
26 </section>`;
27 }
28 return section;
29 }
30
31 /**
32 *
33 * @param {Object} ctx
34 * @param {Object} options
35 * @param {Object} options.manager
36 * @param {String} options.manager.pageTitle
37 * @param {String[]} options.manager.footerEntries
38 * @param {String} options.adminContactHTML
39 * @returns {String}
40 */
41 module.exports = (ctx, options) => {
42 const contactHTML = options.adminContactHTML;
43 const htmlOptions = {
44 pageTitle: options.manager.pageTitle,
45 logoUrl: options.manager.logoUrl,
46 footerEntries: options.manager.footerEntries,
47 navLinks: [
48 {
49 text: 'Admin',
50 href: 'admin/',
51 },
52 {
53 text: 'Ticket',
54 href: 'admin/ticket',
55 },
56 ],
57 };
58 const content = [
59 aboutSection(),
60 contactSection(contactHTML),
61 ];
62 return th.htmlPage(1, ctx, htmlOptions, content);
63 };