1
0
Fork 0
forked from muyrety/Smarter
Smarter/smarter/templates/game/owner_view.j2
Arija A. a3a6316054
.html -> .j2 for Jinja2 correctness
Signed-off-by: Arija A. <ari@ari.lt>
2025-05-27 23:34:42 +03:00

77 lines
4 KiB
Django/Jinja

{% extends "base.j2" %}
{% block title %} Owner dashboard {% endblock %}
{% block head %}
<script src="https://cdn.socket.io/4.8.1/socket.io.min.js" integrity="sha384-mkQ3/7FUtcGyoppY6bz/PORYoGqOl7/aSUMn2ymDOJcapfS6PHqxhRTMh1RR0Q6+" crossorigin="anonymous"></script>
{% endblock %}
{% block after_bootstrap_js %}
<script src="{{ url_for('static', filename='js/owner_view.js') }}"></script>
{% endblock %}
{% block main %}
<div class="container text-center">
<div id="deleteGameModal" class="modal fade" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content bg-info-subtle text-success border-success-subtle">
<div class="modal-header border-success-subtle">
<h5 class="modal-title">Are you sure?</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete the game? This action is irreversible.</p>
</div>
<div class="modal-footer justify-content-evenly border-success-subtle">
<button type="button" class="btn btn-outline-success" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-outline-danger" id="deleteGame" data-bs-dismiss="modal">Delete game</button>
</div>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="d-none col-md-5 mt-1 alert bg-info-subtle text-success border-success-subtle alert-dismissible" id="reconnectAlert">
You lost your connection but have now been reconnected. Info shown might be out of date. Please refresh the page for the newest data.
<button id="reconnectAlertDismiss" type="button" class="btn-close"></button>
</div>
</div>
<div class="row mt-3 justify-content-between">
<h1 class="col-md-4 text-primary-emphasis"> {{ name }} <span id="currentQuestionNr">{{ curr_question }}</span>/{{ total }}</h1>
<div class="col-md-4">
<button class="btn btn-outline-danger" data-bs-toggle="modal" data-bs-target="#deleteGameModal">Delete game</button>
</div>
</div>
<hr class="border-primary">
<h2 class="{{ 'd-none' if not answering }} text-primary-emphasis" id="currentQuestionH"> Current question:
<span id="currentQuestion">{{ question if answering}}</span>
</h2>
<h2 class="{{ 'd-none' if answering }} text-primary-emphasis" id="nextQuestionH"> Next question:
<span id="nextQuestion">{{ question if not answering}}</span>
</h2>
<div class="col mt-2">
<button class="{{ 'd-none' if answering }} btn btn-outline-primary" id="beginAnswering"> Begin answering </button>
<button class="{{ 'd-none' if not answering }} btn btn-outline-danger" id="endAnswering"> Stop question answering </button>
</div>
<hr class="border-primary">
<table class="table table-info border-primary-subtle" id="leaderboard">
<thead>
<tr>
<th scope="col" class="text-primary-emphasis">#</th>
<th scope="col" class="text-primary-emphasis">Username</th>
<th scope="col" class="text-primary-emphasis">Score</th>
<th class="{{ 'd-none' if not answering }} text-primary-emphasis" id="answeredHeader" scope="col">Answered</th>
</tr>
</thead>
<tbody>
{% for player in leaderboard %}
<tr>
<th class="position text-primary-emphasis" scope="row">{{ loop.index }}</th>
<td class="username text-primary-emphasis">{{ player.username }}</td>
<td class="points text-primary-emphasis">{{ player.correct_answers }}</td>
<td class="answered-data text-primary-emphasis {{ 'd-none' if not answering }}">{{ 'Yes' if player.answered else 'No' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}