Browse Source

add help route and index view

develop
Rob Colbert 2 years ago
parent
commit
0aa6e019af
  1. 49
      app/controllers/help.js
  2. 4
      app/views/components/off-canvas.pug
  3. 19
      app/views/help/index.pug
  4. 4
      app/views/index.pug
  5. 11
      config/limiter.js

49
app/controllers/help.js

@ -0,0 +1,49 @@
// welcome.js
// Copyright (C) 2022 DTP Technologies, LLC
// License: Apache-2.0
'use strict';
const DTP_COMPONENT_NAME = 'welcome';
const path = require('path');
const express = require('express');
const captcha = require('svg-captcha');
const { SiteController/*, SiteError */ } = require('../../lib/site-lib');
class HelpController extends SiteController {
constructor (dtp) {
super(dtp, DTP_COMPONENT_NAME);
}
async start ( ) {
const { limiter: limiterService } = this.dtp.services;
const router = express.Router();
this.dtp.app.use(
'/help',
limiterService.create(limiterService.config.help.getHome),
router,
);
router.get('/', this.getHomeView.bind(this));
return router;
}
async getHomeView (req, res) {
res.render('help/index');
}
}
module.exports = {
slug: 'help',
name: 'help',
create: async (dtp) => {
let controller = new HelpController(dtp);
return controller;
},
};

4
app/views/components/off-canvas.pug

@ -20,6 +20,10 @@ mixin renderMenuItem (iconClass, label)
a(href='/').uk-display-block
+renderMenuItem('fa-home', 'Home')
li(class={ "uk-active": (currentView === 'help') })
a(href='/help').uk-display-block
+renderMenuItem('fa-helicopter', 'Help')
if user
li.uk-nav-header Member Menu

19
app/views/help/index.pug

@ -0,0 +1,19 @@
extends ../layouts/main
block content
section.uk-section.uk-section-default.uk-section-small
.uk-container
h1 HELP!
p This is the online help. It will eventually more helpful.
h2 Game Play
ol
li Each player is dealt 7 answer cards at the start of the game
li A Führer is chosen at the start of each round
li A question card is dislayed to start each round
li Each player selects an answer card or cards from their hand for the question (depending on the question's format)
li The Führer will then reveal each selected answer and read the question and answer together
li Führer then selects their favorite answer, which becomes the winning answer for that round.

4
app/views/index.pug

@ -1,7 +1,9 @@
extends layouts/main-sidebar
block content
.uk-margin
img(src="/img/landing-attract.png").responsive
h1= config.site.name
img(src="/img/landing-attract.png").responsive
p Game description goes here.

11
config/limiter.js

@ -86,6 +86,17 @@ module.exports = {
},
},
/*
* HelpController
*/
help: {
getHome: {
total: 20,
expire: ONE_MINUTE,
message: 'You are loading help too quickly',
}
},
/*
* HomeController
*/

Loading…
Cancel
Save