X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=src%2Ftemplate%2Fadmin-ticket-html.js;h=75d7ce7f7475e957f2e8020d2943c476c130878a;hb=f0bf29c75b0fd405ff92fa76f058e61162b87e43;hp=492c40d1dfc3d4fba87a0936cff1883359ed8cc1;hpb=b0103b0d496262c438b40bc20304081dbfe41e73;p=squeep-indie-auther diff --git a/src/template/admin-ticket-html.js b/src/template/admin-ticket-html.js index 492c40d..75d7ce7 100644 --- a/src/template/admin-ticket-html.js +++ b/src/template/admin-ticket-html.js @@ -5,31 +5,47 @@ */ const th = require('./template-helper'); +const { sessionNavLinks } = require('@squeep/authentication-module'); +/** + * + * @param {string} profile profile + * @returns {string} option + */ function renderProfileOption(profile) { return ``; } +/** + * + * @param {string} scope scope + * @returns {string} tr + */ function renderScopeCheckboxTR(scope) { const defaultChecked = ['read']; const checked = defaultChecked.includes(scope) ? ' checked' : ''; return ` -\t +\t \t${scope} `; } +/** + * + * @param {object} ctx context + * @returns {string} section + */ function mainContent(ctx) { const profileOptions = th.indented(4, (ctx?.profilesScopes?.profiles || []).map((profile) => renderProfileOption(profile))) .join('\n'); const elideScopes = ['profile', 'email']; const allScopes = Object.keys(ctx?.profilesScopes?.scopeIndex || {}); const displayScopes = (allScopes).filter((scope) => !elideScopes.includes(scope)); - const scopesCheckboxRows = th.indented(4, displayScopes.map((scope) => renderScopeCheckboxTR(scope))) + const scopesCheckboxRows = th.indented(5, displayScopes.map((scope) => renderScopeCheckboxTR(scope))) .join('\n'); return `
-\t
+\t \t\t
\t\t\tYou may proactively send a ticket to a third-party site, \t\t\twhich they may redeem for an access token which grants additional @@ -52,14 +68,16 @@ ${profileOptions}
Scopes \t\t\t +\t\t\t\t ${scopesCheckboxRows} +\t\t\t\t \t\t\t
\t\t\t
\t\t\t \t\t\t \t\t\t
-\t\t\t +\t\t\t \t\t \t
`; @@ -68,31 +86,29 @@ ${scopesCheckboxRows} /** * - * @param {Object} ctx - * @param {Object} ctx.profilesScopes.scopeIndex - * @param {String[]} ctx.profileScopes.profiles - * @param {Object} options - * @param {Object} options.manager - * @param {String} options.manager.pageTitle - * @param {String} options.manager.logoUrl - * @param {String[]} options.manager.footerEntries - * @returns {String} + * @param {object} ctx context + * @param {object} ctx.profilesScopes.scopeIndex scopes structure + * @param {string[]} ctx.profileScopes.profiles profile + * @param {object} options options + * @param {object} options.manager manager options + * @param {string} options.manager.pageTitle page title + * @param {string} options.manager.logoUrl logo url + * @param {string[]} options.manager.footerEntries footer entries + * @returns {string} page */ module.exports = (ctx, options) => { + const pagePathLevel = 1; const htmlOptions = { + pageIdentifier: 'ticketProffer', pageTitle: options.manager.pageTitle + ' - Ticket Proffer', logoUrl: options.manager.logoUrl, footerEntries: options.manager.footerEntries, - navLinks: [ - { - text: 'Admin', - href: '../admin/', - }, - ], errorContent: ['Unable to send ticket.'], }; + th.navLinks(pagePathLevel, ctx, htmlOptions); + sessionNavLinks(pagePathLevel, ctx, htmlOptions); const content = [ mainContent(ctx), ]; - return th.htmlPage(2, ctx, htmlOptions, content); + return th.htmlPage(pagePathLevel, ctx, htmlOptions, content); }; \ No newline at end of file