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

Added add test and add class buttons to tests and classes pages

This commit is contained in:
2022-03-06 22:46:32 +00:00
parent cface26bc9
commit c6419cad8b
8 changed files with 50 additions and 17 deletions

View File

@@ -13,7 +13,8 @@ router.get('/classes', async (req, res) => {
title: 'Stratos - Classes',
current: 'Classes',
name: req.session.fullName,
classes: await u.getClasses()
classes: await u.getClasses(),
userType: req.session.userType
});
});

View File

@@ -13,7 +13,8 @@ router.get('/tests', async (req, res) => {
title: 'Stratos - Tests',
current: 'Tests',
name: req.session.fullName,
tests: await u.getTests()
tests: await u.getTests(),
userType: req.session.userType
});
});

View File

@@ -35,6 +35,13 @@
.adminSection {
margin: 1rem 0;
&--buttons {
display: flex;
gap: 1rem;
justify-content: flex-end;
align-items: center;
}
&:last-child {
margin-bottom: 0;
padding-bottom: 1rem;

View File

@@ -14,6 +14,10 @@
}
}
.btn--lg {
padding: 1em 3em;
}
@each $name, $colour in $button-colours {
.btn.btn--#{$name}.btn--full {
background: $colour;

View File

@@ -1,4 +1,5 @@
.classes {
&__classes {
display: grid;
column-gap: 1rem;
row-gap: 1.5rem;
@@ -12,3 +13,4 @@
grid-template-columns: repeat(3, 1fr);
}
}
}

View File

@@ -1,7 +1,17 @@
<section class='classes'>
<section class='adminSection adminSection--buttons'>
{{#eq userType 'account'}}
<div class='classes__buttons'>
{{> button style='full' colour='primary' to='/admin/class/add' content='Add a new class' size='lg' }}
</div>
{{/eq}}
</section>
<section class='adminSection classes'>
<div class='classes__classes'>
{{#each classes}}
{{> class name=name teacher=teachers.[0] id=id }}
{{/each}}
</div>
</section>
<script>

View File

@@ -1,3 +1,3 @@
<a class='btn btn--{{ style }} btn--{{ colour }}' href='{{ to }}'>
<a class='btn btn--{{ style }} btn--{{ colour }} btn--{{ size }}' href='{{ to }}'>
{{ content }}
</a>

View File

@@ -1,4 +1,12 @@
<section class='tests adminSection'>
<section class='adminSection adminSection--buttons'>
{{#eq userType 'account'}}
<div class='classes__buttons'>
{{> button style='full' colour='primary' to='/admin/test/add' content='Add a new test' size='lg' }}
</div>
{{/eq}}
</section>
<section class='adminSection tests'>
<div class='adminItem'>
<h2>Tests</h2>
<div class='adminTable'>