mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 04:44:19 +01:00
Refactor elimination feature and improve backoffice usability
This commit introduces a refactored EliminationFactory for better modularity, updates the elimination preparation process, and adds functionality to view eliminations. Backoffice templates and forms have been reorganized, minor translations were corrected, and additional assets like styles and flashes were included for enhanced user experience.
This commit is contained in:
@@ -1,49 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="nl" data-bs-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||
crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
||||
crossorigin="anonymous"></script>
|
||||
<script
|
||||
src="https://js-de.sentry-cdn.com/30cf438bc708c97e6f45c127bed9af96.min.js"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="icon"
|
||||
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
|
||||
<title>
|
||||
{% block title %}Tijd voor de test{% endblock title %}
|
||||
</title>
|
||||
{% block stylesheets %}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block nav %}
|
||||
{{ include('backoffice/nav.html.twig') }}
|
||||
{% endblock nav %}
|
||||
<main>
|
||||
<div class="container">
|
||||
{% for label, messages in app.flashes() %}
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ label }} alert-dismissible " role="alert">
|
||||
{{ message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% block body %}
|
||||
{% endblock body %}
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
{% extends 'base.html.twig' %}
|
||||
{% block importmap %}{{ importmap('backoffice') }}{% endblock %}
|
||||
{% block nav %}{{ include('backoffice/nav.html.twig') }}{% endblock %}
|
||||
|
||||
41
templates/backoffice/login/login.html.twig
Normal file
41
templates/backoffice/login/login.html.twig
Normal file
@@ -0,0 +1,41 @@
|
||||
{% extends 'backoffice/base.html.twig' %}
|
||||
|
||||
{% block title %}Log in{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_login_logout') }}">Logout</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<form method="post">
|
||||
<h1 class="py-2 h3 mb-3 font-weight-normal">{{ 'Please sign in'|trans }}</h1>
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">{{ 'Email'|trans }}</label>
|
||||
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control"
|
||||
autocomplete="email" required autofocus>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">{{ 'Password'|trans }}</label>
|
||||
<input type="password" name="_password" id="password" class="form-control"
|
||||
autocomplete="current-password"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="_csrf_token" data-controller="csrf-protection"
|
||||
value="{{ csrf_token('authenticate') }}">
|
||||
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" name="_remember_me" id="_remember_me" class="form-check-input">
|
||||
<label for="_remember_me" class="form-check-label">{{ 'Remember me'|trans }}</label>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
{{ 'Sign in'|trans }}
|
||||
</button>
|
||||
<a href="{{ path('app_register') }}"
|
||||
class="btn btn-link">{{ 'Create an account'|trans }}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
@@ -1,3 +1,40 @@
|
||||
{% extends 'backoffice/base.html.twig' %}
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{ path('app_backoffice_index') }}">Home</a></li>
|
||||
<li class="breadcrumb-item"><a
|
||||
href="{{ path('app_backoffice_season', {seasonCode: elimination.quiz.season.seasonCode}) }}">{{ elimination.quiz.season.name }}</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a
|
||||
href="{{ path('app_backoffice_quiz', {seasonCode: elimination.quiz.season.seasonCode, quiz: elimination.quiz.id}) }}">{{ elimination.quiz.name }}</a>
|
||||
</li>
|
||||
|
||||
<li class="breadcrumb-item active" aria-current="page">Prepare Elimination</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<form>
|
||||
{%~ for candidate, colour in elimination.data %}
|
||||
<div class="row mb-3">
|
||||
<label for="colour-{{ candidate|lower }}" class="col-4 col-form-label">{{ candidate }}</label>
|
||||
<div class="col-4">
|
||||
<select id="colour-{{ candidate|lower }}" class="form-select"
|
||||
name="colour-{{ candidate|lower }}">
|
||||
<option value="green"{% if colour == 'green' %} selected{% endif %}>Green</option>
|
||||
<option value="red"{% if colour == 'red' %} selected{% endif %}>Red</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn btn-primary">{{ 'Save'|trans }}</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<p>Hier kan dus weer wat uitleg komen</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div id="questions">
|
||||
<h4 class="py-2">{{ 'Questions'|trans }}</h4>
|
||||
<div class="accordion">
|
||||
{% for question in quiz.questions %}
|
||||
{%~ for question in quiz.questions ~%}
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed"
|
||||
@@ -23,23 +23,23 @@
|
||||
data-bs-target="#question-{{ loop.index0 }}"
|
||||
aria-controls="question-{{ loop.index0 }}">
|
||||
{% set questionErrors = question.getErrors %}
|
||||
{% if questionErrors %}
|
||||
{%~ if questionErrors -%}
|
||||
<span data-bs-toggle="tooltip"
|
||||
title="{{ questionErrors }}"
|
||||
class="badge text-bg-danger rounded-pill me-2">!</span>
|
||||
{% endif %}
|
||||
{{ loop.index }}. {{ question.question }}
|
||||
{{~ loop.index -}}. {{ question.question -}}
|
||||
</button>
|
||||
</h2>
|
||||
<div id="question-{{ loop.index0 }}"
|
||||
class="accordion-collapse collapse">
|
||||
<div class="accordion-body">
|
||||
<ul>
|
||||
{% for answer in question.answers %}
|
||||
<li {% if answer.isRightAnswer %}class="text-decoration-underline"{% endif %}>{{ answer.text }}</li>
|
||||
{% else %}
|
||||
{{ 'There are no answers for this question'|trans }}
|
||||
{% endfor %}
|
||||
{%~ for answer in question.answers %}
|
||||
<li{% if answer.isRightAnswer %} class="text-decoration-underline"{% endif %}>{{ answer.text -}}</li>
|
||||
{%~ else %}
|
||||
{{ 'There are no answers for this question'|trans -}}
|
||||
{%~ endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,17 +50,23 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="scores">
|
||||
<p>
|
||||
<h4>{{ 'Score'|trans }}</h4>
|
||||
</p>
|
||||
<h4 class="py-2">{{ 'Score'|trans }}</h4>
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group btn-group-lg me-2">
|
||||
<a class="btn btn-primary">{{ 'Start Elimination'|trans }}</a>
|
||||
</div>
|
||||
<div class="btn-group btn-group-lg">
|
||||
<a href="{{ path('app_prepare_elimination', {seasonCode: season.seasonCode, quiz: quiz.id}) }}"
|
||||
class="btn btn-secondary">{{ 'Prepare Custom Elimination'|trans }}</a>
|
||||
<a class="btn btn-secondary">{{ 'Load Prepared Elimination'|trans }}</a>
|
||||
{%~ if not quiz.eliminations.empty %}
|
||||
<button class="btn btn-secondary dropdown-toggle"
|
||||
data-bs-toggle="dropdown">{{ 'Load Prepared Elimination'|trans }}</button>
|
||||
<ul class="dropdown-menu">
|
||||
{%~ for elimination in quiz.eliminations %}
|
||||
<li><a class="dropdown-item"
|
||||
href="{{ path('app_prepare_elimination_view', {elimination: elimination.id}) }}">{{ elimination.created | format_datetime() }}</a>
|
||||
</li>
|
||||
{%~ endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<p>{{ 'Number of dropouts:'|trans }} {{ quiz.dropouts }} </p>
|
||||
@@ -75,9 +81,9 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for candidate in result %}
|
||||
{%~ for candidate in result ~%}
|
||||
<tr class="table-{% if loop.revindex > quiz.dropouts %}success{% else %}danger{% endif %}">
|
||||
<td>{{ candidate.0.name }}</td>
|
||||
<td>{{ candidate.name }}</td>
|
||||
<td>{{ candidate.correct|default('0') }}</td>
|
||||
<td>{{ candidate.corrections|default('0') }}</td>
|
||||
<td>{{ candidate.score|default('x') }}</td>
|
||||
@@ -93,6 +99,7 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block javascripts %}
|
||||
{{ parent() }}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-12">
|
||||
<h2 class="py-2">{{ t('Add a quiz to %name%', {'%name%': season.name})|trans }} </h2>
|
||||
<h2 class="py-2">{{ t('Add a quiz to %name%',{'%name%': season.name})|trans }} </h2>
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.sheet) }}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<h1>Hi! Please confirm your email!</h1>
|
||||
|
||||
<p>
|
||||
Please confirm your email address by clicking the following link: <br><br>
|
||||
<a href="{{ signedUrl|raw }}">Confirm my Email</a>.
|
||||
This link will expire in {{ expiresAtMessageKey|trans(expiresAtMessageData, 'VerifyEmailBundle') }}.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Cheers!
|
||||
</p>
|
||||
17
templates/backoffice/registration/register.html.twig
Normal file
17
templates/backoffice/registration/register.html.twig
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends 'backoffice/base.html.twig' %}
|
||||
{% block title %}{{ 'Register'|trans }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h3>{{ 'Register'|trans }}</h3>
|
||||
|
||||
{{ form_errors(registrationForm) }}
|
||||
|
||||
{{ form_start(registrationForm) }}
|
||||
{{ form_row(registrationForm.email) }}
|
||||
{{ form_row(registrationForm.plainPassword) }}
|
||||
|
||||
<button type="submit" class="btn btn-primary">Register</button>
|
||||
<a href="{{ path('app_login_login') }}" class="btn btn-link">{{ 'Already have an account? Log in'|trans }}</a>
|
||||
|
||||
{{ form_end(registrationForm) }}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user