sprint/templates/block_settings.html
Egor Matveev 9c0123cbf2 initial
2021-07-11 10:28:12 +03:00

126 lines
6.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends 'base.html' %}
{% load filters %}
{% block title %}{{ Block.name }}|настройки{% endblock %}
{% block styles %}
input[type="file"] {
display: none;
}
{% endblock %}
{% block scripts %}
function uploaded() {
document.getElementById('is_uploaded').style.display = 'block';
document.getElementById('is_uploaded').nodeValue = document.getElementById('file-upload').nodeValue;
}
{% endblock %}
{% block content %}
<h3>{{ Block.name }} <a style="color: black;" href="/block?id={{ Block.id }}"><i class="fa fa-eye"></i></a></h3>
<h5>Таски</h5>
{% for task in Block.tasks %}
<a href="/admin/task?id={{ task.id }}">{{ task.name }}</a><br>
{% endfor %}
{% if is_superuser %}
<button type="button" class="btn btn-dark" data-toggle="modal" data-target="#example" style="margin-top: 20px;">
<i class="fa fa-plus-circle"></i> Новый таск
</button>
<!-- Modal -->
<div class="modal fade" id="example" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
<div class="modal-dialog" role="document">
<form method="POST">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Новый таск в блоке {{ Block.name }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-12">
{% csrf_token %}
<input type="text" name="name" placeholder="Имя таска">
<input type="hidden" name="block_id" value="{{ Block.id }}">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times-circle"></i> Закрыть</button>
<button type="submit" class="btn btn-success"><i class="fa fa-plus-circle"></i> Создать</button>
</div>
</div>
</form>
</div>
</div>
<hr>
<h5>Импортировать задачу из Я.Контест</h5>
<form action="" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<label for="file-upload" class="btn btn-dark" style="margin-top: 20px;">
<i class="fa fa-upload"></i> Загрузить архив
</label>
<span id="is_uploaded" style="display: none;">Архив загружен</span>
<input type="file" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file" onchange="uploaded()">
<br><button type="submit" value="Импортировать" class="btn btn-outline-dark"><i class="fa fa-play-circle"></i> Импортировать</button>
</form>
{% endif %}
<hr>
{% if is_superuser %}
<h3>Ограничения по времени</h3>
<form method="POST">
{% csrf_token %}
<table>
<tr>
<td>
<input type="datetime-local" name="time_start" value="{{ Block.time_start_chrome }}">
</td>
<td>
<input type="datetime-local" name="time_end" value="{{ Block.time_end_chrome }}">
</td>
</tr>
<tr>
<td>
Открыто для просмотра<input type="checkbox" name="opened" style="margin-left:15px;" {{ Block.is_opened }}>
</td>
</tr>
<tr>
<td>
Показывать рейтинг участникам<input type="checkbox" name="rating" style="margin-left: 15px;" {% if Block.show_rating %}checked{% endif %}>
</td>
</tr>
<tr>
<td>
Приоритет <select name="priority">
{% for i in 10|num_range %}
<option {% if i == Block.priority %}selected{% endif %}>{{ i }}</option>
{% endfor %}
</select>
</td>
</tr>
</table>
<button class="btn btn-dark" value="Установить" type="submit" style="margin-top: 20px;"><i class="fa fa-save"></i> Установить</button>
</form>
<hr>
{% endif %}
<div>
<a class="btn btn-dark" href="/admin/rating?block_id={{ Block.id }}"><i class="fa fa-star"></i> Рейтинг</a>
<button type="button" class="btn btn-dark" onclick="window.location.href = '/admin/solutions?block_id=' + {{ Block.id }}" value="Посмотреть решения"><i class="fa fa-list-ul"></i> Посмотреть решения</button>
<a class="btn btn-dark" href="/admin/queue?block_id={{ Block.id }}"><i class="fa fa-align-left"></i> Очередь тестирования</a>
<a class="btn btn-dark" href="/admin/cheating?block_id={{ Block.id }}"><i class="fa fa-bomb"></i> Проверка на списывание</a>
{% if is_superuser %}
<form method="POST" onsubmit="return confirm('Сейчас ты пытаешься сделать то, что может привести к серьезным последствиям. Если ты удалишь этот блок, то вместе с ним удалятся все таски, условия, тесты, дополнительные файлы и решения, сдаваемые в этот блок. Все данные будут безвозвратно утеряны. Оно нам надо?');">
{% csrf_token %}
<input type="hidden" name="block_delete" value="{{ Block.id }}">
<button type="submit" value="Удалить блок" class="btn btn-dark" style="margin-top: 10px;"><i class="fa fa-trash"></i> Удалить блок</button>
</form>
{% endif %}
</div>
<hr>
{% endblock %}