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', title: 'Stratos - Classes',
current: 'Classes', current: 'Classes',
name: req.session.fullName, 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', title: 'Stratos - Tests',
current: 'Tests', current: 'Tests',
name: req.session.fullName, name: req.session.fullName,
tests: await u.getTests() tests: await u.getTests(),
userType: req.session.userType
}); });
}); });

View File

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

View File

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

View File

@@ -1,14 +1,16 @@
.classes { .classes {
display: grid; &__classes {
column-gap: 1rem; display: grid;
row-gap: 1.5rem; column-gap: 1rem;
margin-top: 1rem; row-gap: 1.5rem;
margin-top: 1rem;
@include respond-to('medium') { @include respond-to('medium') {
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
} }
@include respond-to('large') { @include respond-to('large') {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
}
} }
} }

View File

@@ -1,7 +1,17 @@
<section class='classes'> <section class='adminSection adminSection--buttons'>
{{#each classes}} {{#eq userType 'account'}}
{{> class name=name teacher=teachers.[0] id=id }} <div class='classes__buttons'>
{{/each}} {{> 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> </section>
<script> <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 }} {{ content }}
</a> </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'> <div class='adminItem'>
<h2>Tests</h2> <h2>Tests</h2>
<div class='adminTable'> <div class='adminTable'>