From 0aa6e019af59f643188c3a845254cfeb01b43e74 Mon Sep 17 00:00:00 2001 From: rob Date: Thu, 2 Jun 2022 01:04:08 -0400 Subject: [PATCH] add help route and index view --- app/controllers/help.js | 49 +++++++++++++++++++++++++++++ app/views/components/off-canvas.pug | 4 +++ app/views/help/index.pug | 19 +++++++++++ app/views/index.pug | 4 ++- config/limiter.js | 11 +++++++ 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 app/controllers/help.js create mode 100644 app/views/help/index.pug diff --git a/app/controllers/help.js b/app/controllers/help.js new file mode 100644 index 0000000..368c7cd --- /dev/null +++ b/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; + }, +}; \ No newline at end of file diff --git a/app/views/components/off-canvas.pug b/app/views/components/off-canvas.pug index 4a535b1..460f6b0 100644 --- a/app/views/components/off-canvas.pug +++ b/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 diff --git a/app/views/help/index.pug b/app/views/help/index.pug new file mode 100644 index 0000000..fc813e9 --- /dev/null +++ b/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. diff --git a/app/views/index.pug b/app/views/index.pug index 47fb318..a50c142 100644 --- a/app/views/index.pug +++ b/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. \ No newline at end of file diff --git a/config/limiter.js b/config/limiter.js index 350e855..738241f 100644 --- a/config/limiter.js +++ b/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 */