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

Added tests page

This commit is contained in:
2022-02-06 20:31:29 +00:00
parent c0e1a770b3
commit b6e43df0e3
3 changed files with 81 additions and 0 deletions

View File

@@ -17,6 +17,12 @@ router.get('/classes', (req, res) => {
});
});
router.get('/tests', (req, res) => {
return res.render('tests', {
title: 'Stratos - Tests'
});
});
module.exports = {
root: '/admin',
router: router

6
views/partials/test.hbs Normal file
View File

@@ -0,0 +1,6 @@
<tr data-id='{{ id }}'>
<td>{{ name }}</td>
<td>{{ class }}</td>
<td>{{ subject }}</td>
<td>{{ date }}</td>
</tr>

69
views/tests.hbs Normal file
View File

@@ -0,0 +1,69 @@
<section class='tests adminSection'>
<div class='adminItem'>
<h2>Tests</h2>
<div class='adminTable'>
<table>
<thead>
<tr>
<th>Name</th>
<th>Subject</th>
<th>Class</th>
<th>Date</th>
</tr>
</thead>
{{> test
id='1'
name='Organic Synthesis'
subject='Chemistry'
class='MKA_133'
date='01/08/2021'
}}
{{> test
id='2'
name='Organic Synthesis'
subject='Chemistry'
class='MKA_133'
date='01/08/2021'
}}
{{> test
id='3'
name='Organic Synthesis'
subject='Chemistry'
class='MKA_133'
date='01/08/2021'
}}
{{> test
id='4'
name='Organic Synthesis'
subject='Chemistry'
class='MKA_133'
date='01/08/2021'
}}
{{> test
id='5'
name='Organic Synthesis'
subject='Chemistry'
class='MKA_133'
date='01/08/2021'
}}
{{> test
id='6'
name='Organic Synthesis'
subject='Chemistry'
class='MKA_133'
date='01/08/2021'
}}
</table>
</div>
</div>
</section>
<script>
const tests = document.querySelectorAll('.tests tbody tr');
tests.forEach(t => {
t.addEventListener('click', () => {
window.location.href =
`/admin/test/${t.getAttribute('data-id')}`;
});
});
</script>