1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 22:59:28 +00:00

Added generalised handlebars context

This commit is contained in:
2022-04-19 00:21:40 +00:00
parent 35b4030d27
commit 52c44f298e
9 changed files with 47 additions and 35 deletions

View File

@@ -20,9 +20,9 @@ router.get('/:id', async (req, res) => {
}
return res.render('test', {
...req.hbsContext,
title: `Stratos - ${t.template.name}`,
current: 'Tests',
name: req.session.fullName,
testName: t.template.name,
class: t.class,
subject: t.class.subject.name,
@@ -30,7 +30,6 @@ router.get('/:id', async (req, res) => {
reportsLink: `${linkRoot}/reports`,
resultsLink: `${linkRoot}/results`,
deleteLink: `${linkRoot}/delete`,
userType: req.session.userType,
testResults: results,
stats: [
{
@@ -67,11 +66,10 @@ router.get('/:id/results', async (req, res) => {
const results = await t.getTestResults();
return res.render('testResults', {
...req.hbsContext,
title: `Stratos - ${t.template.name}`,
current: 'Tests',
name: req.session.fullName,
testName: t.template.name,
userType: req.session.userType,
testResults: results,
linkRoot: linkRoot,
addLink: `${linkRoot}/add`
@@ -122,9 +120,9 @@ router.get('/:id/results/add', async (req, res) => {
.filter(s => !existingResults.includes(s.id));
return res.render('addTestResult', {
...req.hbsContext,
title: `Stratos - ${t.template.name}`,
current: 'Tests',
name: req.session.fullName,
testName: t.template.name,
linkRoot: linkRoot,
students: students,