This commit is contained in:
Administrator
2022-04-18 06:52:24 +00:00
parent 28f29fa610
commit 01c592100d
474 changed files with 48732 additions and 1609 deletions

View File

@@ -1,174 +1,183 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block title %}Аккаунт{% endblock %}
{% block main %}
<h2 style="margin-bottom: 40px;">Информация об аккаунте</h2>
<div class="row">
<div class="col-3">
<div style="height: 100%; width: 100%;">
<img src="{{ account.userinfo.profile_pic_url }}" height="100%" width="100%" alt="Фото профиля">
</div>
{% if owner %}
<label for="file-upload" class="btn btn-light" style="margin-top: -100px; margin-left: 10%; width: 80%;">
<i class="fa fa-upload"></i> Загрузить фото
</label>
<input type="file" form="photoform" style="display: none;" accept="image/png, image/jpg" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file" onchange="document.getElementById('photoform').submit();">
<form method="POST" enctype="multipart/form-data" id="photoform">
<input type="hidden" name="action" value="upload_photo">
{% csrf_token %}
</form>
{% endif %}
</div>
<div class="col-9">
<h3>
{{ account.userinfo.surname }} {{ account.userinfo.name }}
<span style="margin-left: 15px; margin-bottom: 20px;" class="badge badge-{% if account.userinfo.activity_status == online_status %}success{% else %}secondary{% endif %}">{{ account.userinfo.activity_status }}</span>
{% if not owner %}
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="friendship">
{% if friendship_status == 0 %}
<button type="submit" class="btn btn-primary" name="to_do" value="add">Добавить в друзья</button>
{% else %}{% if friendship_status == 1 %}
<button class="btn btn-success"><i class="fa fa-check"></i> Друзья</button> <button class="btn btn-danger" type="submit" name="to_do" value="delete"><i class="fa fa-times"></i> Удалить</button>
{% else %}{% if friendship_status == 2 %}
<button class="btn btn-info">Приглашение отправлено</button> <button class="btn btn-danger" type="submit" name="to_do" value="delete">Отменить</button>
{% else %}
<button class="btn btn-info" type="submit" name="to_do" value="yes">Принять</button> <button class="btn btn-danger" type="submit" name="to_do" value="no">Отклонить</button>
{% endif %}{% endif %}{% endif %}
</form>
{% endif %}
{% if user.is_superuser and owner %}
<br>
<a style="background-color: purple;" target="_blank" href="https://sentry.io/organizations/sprint-cu/issues/?project=6235928" class="badge badge-secondary"><i class="fa fa-bug"></i> Sentry</a>
<a style="margin-left: 15px;" href="http://dev.sprinthub.ru:888" target="_blank" class="badge badge-primary"><i class="fa fa-server"></i> Кластер</a>
<a style="margin-left: 15px; background-color: orange;" href="http://dev.sprinthub.ru:15672" target="_blank" class="badge badge-primary"><i class="fa fa-align-left"></i> Очереди</a>
<a style="margin-left: 15px;" href="https://gitlab.com/mathwave/sprint/-/pipelines" target="_blank" class="badge badge-dark"><i class="fa fa-gitlab"></i> Gitlab</a>
<a style="margin-left: 15px;" href="/admin/" target="_blank" class="badge badge-danger"><i class="fa fa-user"></i> Админка</a>
{% endif %}
</h3>
<table>
<tr>
<td>
<h2><i class="fa fa-user"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.username }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-star"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.userinfo.rating }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-arrow-up"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.userinfo.place }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-calendar"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.date_joined.date }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-desktop"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td><p style="padding-top: 8px; font-size: 24px;">
{% if owner %}
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4" style="margin-bottom: 40px;">Информация об аккаунте</h1>
<div class="row">
<div class="col-3">
<div style="height: 100%; width: 100%;">
<img src="{{ account.userinfo.profile_pic_url }}" height="100%" width="100%" alt="Фото профиля">
</div>
{% if owner %}
<label for="file-upload" class="btn btn-gray-50" style="margin-top: -120px; margin-left: 20%; width: 60%;">
<i class="fa fa-upload"></i> Загрузить фото
</label>
<input type="file" form="photoform" style="display: none;" accept="image/png, image/jpg" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file" onchange="document.getElementById('photoform').submit();">
<form method="POST" enctype="multipart/form-data" id="photoform">
<input type="hidden" name="action" value="upload_photo">
{% csrf_token %}
</form>
{% endif %}
</div>
<div class="col-9">
<h3>
{{ account.userinfo.surname }} {{ account.userinfo.name }}
<span style="margin-left: 15px; margin-bottom: 20px;" class="badge badge-{% if account.userinfo.activity_status == online_status %}success{% else %}secondary{% endif %}">{{ account.userinfo.activity_status }}</span>
{% if not owner %}
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="set_language">
<select name="language" onchange="this.form.submit();">
<option value="-1">Предпочитаемый язык отсутствует</option>
{% for lang in languages %}
<option value="{{ lang.id }}"{% if account.userinfo.favourite_language_id == lang.id %} selected{% endif %}>{{ lang }}</option>
{% endfor %}
</select>
<input type="hidden" name="action" value="friendship">
{% if friendship_status == 0 %}
<button type="submit" class="btn btn-primary" name="to_do" value="add">Добавить в друзья</button>
{% else %}{% if friendship_status == 1 %}
<button class="btn btn-success"><i class="fa fa-check"></i> Друзья</button> <button class="btn btn-danger" type="submit" name="to_do" value="delete"><i class="fa fa-times"></i> Удалить</button>
{% else %}{% if friendship_status == 2 %}
<button class="btn btn-info">Приглашение отправлено</button> <button class="btn btn-danger" type="submit" name="to_do" value="delete">Отменить</button>
{% else %}
<button class="btn btn-info" type="submit" name="to_do" value="yes">Принять</button> <button class="btn btn-danger" type="submit" name="to_do" value="no">Отклонить</button>
{% endif %}{% endif %}{% endif %}
</form>
{% else %}
{% if account.userinfo.has_favourite_language %}
<img src="{{ account.userinfo.favourite_language.logo_url }}" height="24px" width="24px"> {{ account.userinfo.favourite_language.name }}
{% else %}
Предпочитаемый язык отсутствует
{% endif %}
{% endif %}
</p></td>
</tr>
{% if owner %}
<tr>
<td>
<h2><i class="fa fa-users"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<a href="https://oauth.vk.com/authorize?client_id=8123759&redirect_uri=http://dev.sprinthub.ru/vk_add&display=page&response_type=token&v=5.59"><img style="width: 40px; height: 40px;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/VK_Compact_Logo_%282021-present%29.svg/1200px-VK_Compact_Logo_%282021-present%29.svg.png"></a>
{% if user.userinfo.vk_user_id %}
<div style="margin-top: -15px; margin-left: 30px;"><i style="color: green;" class="fa fa-check-circle"></i></div>
{% endif %}
</td>
</tr>
{% endif %}
</table>
{% if user.is_superuser and owner %}
<br>
<a style="background-color: purple;" target="_blank" href="https://sentry.io/organizations/sprint-cu/issues/?project=6235928" class="badge bg-primary"><i class="fa fa-bug"></i> Sentry</a>
<a style="margin-left: 15px;" href="http://dev.sprinthub.ru:888" target="_blank" class="badge bg-info"><i class="fa fa-server"></i> Кластер</a>
<a style="margin-left: 15px; background-color: orange;" href="http://dev.sprinthub.ru:15672" target="_blank" class="badge bg-success"><i class="fa fa-align-left"></i> Очереди</a>
<a style="margin-left: 15px;" href="http://gitlab.sprinthub.ru/root/sprint/-/pipelines" target="_blank" class="badge bg-warning"><i class="fa fa-gitlab"></i> Gitlab</a>
<a style="margin-left: 15px;" href="/admin/" target="_blank" class="badge bg-danger"><i class="fa fa-user"></i> Админка</a>
{% endif %}
</h3>
<table>
<tr>
<td>
<h2><i class="fa fa-user"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.username }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-star"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.userinfo.rating }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-arrow-up"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.userinfo.place }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-calendar"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<p style="padding-top: 8px; font-size: 24px;">{{ account.date_joined.date }}</p>
</td>
</tr>
<tr>
<td>
<h2><i class="fa fa-desktop"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td><p style="padding-top: 8px; font-size: 24px;">
{% if owner %}
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="set_language">
<select name="language" onchange="this.form.submit();">
<option value="-1">Предпочитаемый язык отсутствует</option>
{% for lang in languages %}
<option value="{{ lang.id }}"{% if account.userinfo.favourite_language_id == lang.id %} selected{% endif %}>{{ lang }}</option>
{% endfor %}
</select>
</form>
{% else %}
{% if account.userinfo.has_favourite_language %}
<img src="{{ account.userinfo.favourite_language.logo_url }}" height="24px" width="24px"> {{ account.userinfo.favourite_language.name }}
{% else %}
Предпочитаемый язык отсутствует
{% endif %}
{% endif %}
</p></td>
</tr>
{% if owner %}
<tr>
<td>
<h2><i class="fa fa-users"></i></h2>
</td>
<td><div style="width: 20px;"></div></td>
<td>
<a href="https://oauth.vk.com/authorize?client_id=8123759&redirect_uri=http://dev.sprinthub.ru/vk_add&display=page&response_type=token&v=5.59"><img style="width: 40px; height: 40px;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/VK_Compact_Logo_%282021-present%29.svg/1200px-VK_Compact_Logo_%282021-present%29.svg.png"></a>
{% if user.userinfo.vk_user_id %}
<div style="margin-top: -15px; margin-left: 30px;"><i style="color: green;" class="fa fa-check-circle"></i></div>
{% endif %}
</td>
</tr>
{% endif %}
</table>
</div>
</div>
</div>
</div>
{% if owner %}
<hr><hr>
<h2>Уведомления</h2>
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="notifications">
<table>
<tr>
<td style="width: 200px;">
Результаты решений
</td>
<td>
<input type="checkbox" name="notification_solution_result" {% if user.userinfo.notification_solution_result %}checked{% endif %}>
</td>
</tr>
<tr>
<td style="width: 200px;">
Заявки в друзья
</td>
<td>
<input type="checkbox" name="notification_friends" {% if user.userinfo.notification_friends %}checked{% endif %}>
</td>
</tr>
<tr>
<td style="width: 200px;">
Сообщения в оффлайн
</td>
<td>
<input type="checkbox" name="notification_messages" {% if user.userinfo.notification_messages %}checked{% endif %}>
</td>
</tr>
</table>
<button type="submit" class="btn btn-light" style="margin-top: 15px;"><i class="fa fa-save"></i> Сохранить</button>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Уведомления</h1>
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="notifications">
<table>
<tr>
<td style="width: 200px;">
Результаты решений
</td>
<td>
<input type="checkbox" name="notification_solution_result" {% if user.userinfo.notification_solution_result %}checked{% endif %}>
</td>
</tr>
<tr>
<td style="width: 200px;">
Заявки в друзья
</td>
<td>
<input type="checkbox" name="notification_friends" {% if user.userinfo.notification_friends %}checked{% endif %}>
</td>
</tr>
<tr>
<td style="width: 200px;">
Сообщения в оффлайн
</td>
<td>
<input type="checkbox" name="notification_messages" {% if user.userinfo.notification_messages %}checked{% endif %}>
</td>
</tr>
</table>
<button type="submit" class="btn btn-info mt-3">Сохранить</button>
</form>
<hr><hr>
<h2 style="margin-bottom: 20px;">Друзья</h2>
<h5>
{% for friendship in user.userinfo.friends %}
<i class="fa fa-user"></i> <a href="/account?username={% if friendship.to_user == user %}{{ friendship.from_user.username }}{% else %}{{ friendship.to_user.username }}{% endif %}">{% if friendship.to_user == user %}{{ friendship.from_user.username }}{% else %}{{ friendship.to_user.username }}{% endif %}</a>{% if not friendship.verified %} <i class="fa fa-circle" style="color: blue;"></i> {% endif %}<br>
{% endfor %}
</h5>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Друзья</h1>
<h5>
{% for friendship in user.userinfo.friends %}
<i class="fa fa-user"></i> <a href="/account?username={% if friendship.to_user == user %}{{ friendship.from_user.username }}{% else %}{{ friendship.to_user.username }}{% endif %}">{% if friendship.to_user == user %}{{ friendship.from_user.username }}{% else %}{{ friendship.to_user.username }}{% endif %}</a>{% if not friendship.verified %} <i class="fa fa-circle" style="color: blue;"></i> {% endif %}<br>
{% endfor %}
</h5>
</div>
</div>
{% endif %}
{% endblock %}

View File

@@ -1,20 +0,0 @@
<div class="row" style="bottom: 0; height: 90%; position: absolute; top: 5%; left: 10%; right: 10%;">
<div class="col-3" style="overflow-y: scroll;">
<h3>Чаты</h3>
{% for membership in memberships %}
<div {% if membership.chat == current_chat %}style="background-color: #DDDDDD;"{% endif %}>
<hr>
<h4>{{ membership.chat.name }}</h4>
<b>{{ membership.chat.last_message.sender.username }}</b>: {{ membership.chat.last_message.text }} {% if not membership.chat.last_message.is_read %}<i class="fa fa-circle"></i>{% endif %}
<hr>
</div>
{% endfor %}
</div>
<div class="col-9" style="position: relative; align-content: end;">
<div style="position: absolute; bottom: 0; right: 0; left: 0;">
{% for message in messages %}
<b>{{ message.sender.username }}</b>: {{ message.text }}<br>
{% endfor %}
</div>
</div>
</div>

View File

@@ -1,25 +0,0 @@
{% extends 'base_main.html' %}
{% block scripts %}
var chat_id = 1;
var page = 1;
function doPoll() {
jQuery.get('/messaging/chat_window?chat_id=' + chat_id.toString() + '&page=' + page.toString(), function(data) {
var e = document.getElementById('chats');
e.innerHTML = data;
setTimeout(function() {doPoll()}, 1000);
})
}
{% endblock %}
{% block onload %}doPoll(){% endblock %}
{% block main %}
<div id="chats"></div>
<div class="row">
<div class="col-3"></div>
<div class="col-9" style="position: absolute; bottom: 0;">
<textarea name="text" style="width: 100%; height: 80px; resize: none;"></textarea>
</div>
</div>
{% endblock %}

View File

@@ -4,29 +4,21 @@
{% csrf_token %}
<input type="hidden" name="action" value="delete_checker">
<input type="hidden" name="checker_id" value="{{ checker.id }}">
<button type="button" class="btn btn-link" data-toggle="modal" data-target="#exampleCheckers{{ checker.id }}">{{ checker.name }}</button> <span class="badge badge-{% if status == 'Active' %}success{% else %}{% if status == 'Testing' %}info{% else %}danger{% endif %}{% endif %}">{{ status }}</span>{% if status != 'Testing' %}<button type="submit" class="btn btn-link" style="color: black;"><i class="fa fa-times"></i></button>{% endif %}<br>
<button type="button" class="btn text-info" data-bs-toggle="modal" data-bs-target="#modal-checker-{{ checker.id }}">{{ checker.name }}</button> <span class="badge bg-{% if status == 'Active' %}success{% else %}{% if status == 'Testing' %}info{% else %}danger{% endif %}{% endif %}">{{ status }}</span>{% if status != 'Testing' %}<button type="submit" class="btn btn-link" style="color: black;"><i class="fa fa-times"></i></button>{% endif %}<br>
</form>
{% endwith %}
<div class="modal fade" id="exampleCheckers{{ checker.id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitleCheckers{{ checker.id }}" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal fade" id="modal-checker-{{ checker.id }}" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitleCheckers{{ checker.id }}">Токен {{ checker.name }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h2 class="h6 modal-title">{{ checker.name }}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-12">
{{ checker.token }}
</div>
</div>
</div>
{{ checker.token }}
</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="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</div>
</div>

View File

@@ -41,9 +41,7 @@
<div class="center">
<center>
<div>
<h1>
<i class="fa fa-random"></i> Sprint
</h1>
<table><tr><td><img style="height: 80px; width: 80px;" src="/static/assets/img/brand/dark.svg" /></td><td><h1>Sprint</h1></td></tr></table>
</div>
<div>
<p id="message" style="color: red;"></p>

View File

@@ -1,104 +1,97 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block main %}
<h2>{{ group.name }}</h2>
{% if group.creator %}Владелец группы: <img src="{{ group.creator.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;"><a href="/account?username={{ group.creator.username }}">{{ group.creator.username }}</a> {% endif %}
<hr><hr>
<h2>Сеты</h2>
{% if group.creator == user or user.username in group.editors %}
{% for set in group.sets.all %}
<a href="/set?set_id={{ set.id }}">{{ set.name }}</a> {% if set.creator == user or user.username in set.editors %}<a href="/admin/set?set_id={{ set.id }}"><i class="fa fa-pencil"></i> </a><a href="/solutions?set_id={{ set.id }}"><i class="fa fa-stack-overflow"></i> </a>{% endif %}<br>
{% endfor %}
{% else %}
{% for set in group.available_sets %}
<a href="/set?set_id={{ set.id }}">{{ set.name }}</a><br>
{% endfor %}
{% endif %}
{% if group.creator == user or user.username in group.editors %}
<button type="button" class="btn btn-primary" style="margin-top: 20px;" data-toggle="modal" data-target="#example"><i class="fa fa-pencil"></i> Редактировать</button>
<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">Редактировать набор сетов</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 %}
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">{{ group.name }}</h1>
Владелец группы: <img src="{{ group.creator.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;"><a href="/account?username={{ group.creator.username }}">{{ group.creator.username }}</a>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Сеты</h1>
{% if group.creator == user or user.username in group.editors %}
{% for set in group.sets.all %}
<a href="/set?set_id={{ set.id }}">{{ set.name }}</a> {% if set.creator == user or user.username in set.editors %}<a href="/admin/set?set_id={{ set.id }}"><i class="fa fa-pencil"></i> </a><a href="/solutions?set_id={{ set.id }}"><i class="fa fa-stack-overflow"></i> </a>{% endif %}<br>
{% endfor %}
{% else %}
{% for set in group.available_sets %}
<a href="/set?set_id={{ set.id }}">{{ set.name }}</a><br>
{% endfor %}
{% endif %}
{% if group.creator == user or user.username in group.editors %}
<button type="button" class="btn btn-block btn-info mt-3" data-bs-toggle="modal" data-bs-target="#modal-edit-sets">Редактировать</button>
<div class="modal fade" id="modal-edit-sets" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать сеты</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="sets_edit">
{% for set in user.userinfo.available_sets %}
<input type="checkbox" {% if set in group.sets.all %}checked{% endif %} name="set_{{ set.id }}"> <a href="/set?set_id={{ set.id }}">{{ set.name }}</a><br>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Сохранить</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</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-check"></i> Установить</button>
</div>
</div>
</form>
{% endif %}
</div>
</div>
{% endif %}
<hr><hr>
<h2>Пользователи</h2>
{% for u in group.users.all %}
<img src="{{ u.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;"><a href="/account?username={{ u.username }}">{{ u.username }}</a><br><br>
{% endfor %}
{% if group.creator == user or user.username in group.editors %}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleU"><i class="fa fa-pencil"></i> Редактировать</button>
{% if group.access_token %}
<button type="submit" form="close_link" class="btn btn-danger"><i class="fa fa-lock"></i> Закрыть доступ по токену</button><input style="width: 300px; margin-left: 10px;" value="{{ group.access_token }}">
<form method="POST" id="close_link">
{% csrf_token %}
<input type="hidden" name="action" value="close_link">
</form>
{% else %}
<button type="submit" form="open_link" class="btn btn-success"><i class="fa fa-unlock"></i> Открыть доступ по токену</button>
<form method="POST" id="open_link">
{% csrf_token %}
<input type="hidden" name="action" value="open_link">
</form>
{% endif %}
<div class="modal fade" id="exampleU" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitleU" 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="exampleModalLongTitleU">Редактировать участников группы</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 %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Пользователи</h1>
{% for u in group.users.all %}
<img src="{{ u.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;"><a href="/account?username={{ u.username }}">{{ u.username }}</a><br><br>
{% endfor %}
{% if group.creator == user or user.username in group.editors %}
<button type="button" class="btn btn-block btn-info mb-3" data-bs-toggle="modal" data-bs-target="#modal-edit-users">Редактировать</button>
{% if group.access_token %}
<button type="submit" form="close_link" class="btn btn-block btn-danger mb-3">Закрыть доступ по токену</button><input style="width: 300px; margin-left: 10px;" value="{{ group.access_token }}">
<form method="POST" id="close_link">
{% csrf_token %}
<input type="hidden" name="action" value="close_link">
</form>
{% else %}
<button type="submit" form="open_link" class="btn btn-block btn-success mb-3" style="color: white;"> Открыть доступ по токену</button>
<form method="POST" id="open_link">
{% csrf_token %}
<input type="hidden" name="action" value="open_link">
</form>
{% endif %}
<div class="modal fade" id="modal-edit-users" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать участников</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="users_edit">
{% for u in possible_users %}
<input type="checkbox" {% if u in group.users.all %}checked{% endif %} name="user_{{ u.id }}"> <a href="/account?username={{ u.username }}">{{ u.username }}</a><br>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Сохранить</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</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-check"></i> Установить</button>
</div>
</div>
</form>
{% endif %}
</div>
</div>
{% endif %}
<hr><hr>
{% endblock %}

View File

@@ -0,0 +1,19 @@
<footer class="bg-white rounded shadow p-5 mb-4 mt-4">
<div class="row">
<div class="col-12 col-md-4 col-xl-6 mb-4 mb-md-0">
<p class="mb-0 text-center text-lg-start">
&copy; <a class="text-primary fw-normal" href="https://themesberg.com" target="_blank">Themesberg</a>
- Coded by <a href="https://appseed.us" target="_blank">AppSeed</a>.
</p>
</div>
<div class="col-12 col-md-8 col-xl-6 text-center text-lg-start">
<!-- List -->
<ul class="list-inline list-group-flush list-group-borderless text-md-end mb-0">
<li class="list-inline-item px-0 px-sm-2">
<a target="_blank"
href="https://appseed.us/admin-dashboards/django-dashboard-volt">Django Volt Dashboard</a>
</li>
</ul>
</div>
</div>
</footer>

View File

@@ -0,0 +1,158 @@
<nav class="navbar navbar-top navbar-expand navbar-dashboard navbar-dark ps-0 pe-2 pb-0">
<div class="container-fluid px-0">
<div class="d-flex justify-content-between w-100" id="navbarSupportedContent">
<div class="d-flex align-items-center">
<!-- Search form -->
<!-- / Search form -->
</div>
<!-- Navbar links -->
<ul class="navbar-nav align-items-center">
<li class="nav-item dropdown">
<!--a class="nav-link text-dark notification-bell unread dropdown-toggle" data-unread-notifications="true" href="#" role="button" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
<svg class="icon icon-sm text-gray-900" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zM10 18a3 3 0 01-3-3h6a3 3 0 01-3 3z"></path></svg>
</a-->
<!--div class="dropdown-menu dropdown-menu-lg dropdown-menu-center mt-2 py-0">
<div class="list-group list-group-flush">
<a href="#" class="text-center text-primary fw-bold border-bottom border-light py-3">Notifications</a>
<a href="#" class="list-group-item list-group-item-action border-bottom">
<div class="row align-items-center">
<div class="col-auto">
<img alt="Image placeholder" src="/static/assets/img/team/profile-picture-1.jpg" class="avatar-md rounded">
</div>
<div class="col ps-0 ms-2">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="h6 mb-0 text-small">Jose Leos</h4>
</div>
<div class="text-end">
<small class="text-danger">a few moments ago</small>
</div>
</div>
<p class="font-small mt-1 mb-0">Added you to an event "Project stand-up" tomorrow at 12:30 AM.</p>
</div>
</div>
</a>
<a href="#" class="list-group-item list-group-item-action border-bottom">
<div class="row align-items-center">
<div class="col-auto">
<img alt="Image placeholder" src="/static/assets/img/team/profile-picture-2.jpg" class="avatar-md rounded">
</div>
<div class="col ps-0 ms-2">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="h6 mb-0 text-small">Neil Sims</h4>
</div>
<div class="text-end">
<small class="text-danger">2 hrs ago</small>
</div>
</div>
<p class="font-small mt-1 mb-0">You've been assigned a task for "Awesome new project".</p>
</div>
</div>
</a>
<a href="#" class="list-group-item list-group-item-action border-bottom">
<div class="row align-items-center">
<div class="col-auto">
<img alt="Image placeholder" src="/static/assets/img/team/profile-picture-3.jpg" class="avatar-md rounded">
</div>
<div class="col ps-0 m-2">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="h6 mb-0 text-small">Roberta Casas</h4>
</div>
<div class="text-end">
<small>5 hrs ago</small>
</div>
</div>
<p class="font-small mt-1 mb-0">Tagged you in a document called "Financial plans",</p>
</div>
</div>
</a>
<a href="#" class="list-group-item list-group-item-action border-bottom">
<div class="row align-items-center">
<div class="col-auto">
<img alt="Image placeholder" src="/static/assets/img/team/profile-picture-4.jpg" class="avatar-md rounded">
</div>
<div class="col ps-0 ms-2">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="h6 mb-0 text-small">Joseph Garth</h4>
</div>
<div class="text-end">
<small>1 d ago</small>
</div>
</div>
<p class="font-small mt-1 mb-0">New message: "Hey, what's up? All set for the presentation?"</p>
</div>
</div>
</a>
<a href="#" class="list-group-item list-group-item-action border-bottom">
<div class="row align-items-center">
<div class="col-auto">
<img alt="Image placeholder" src="/static/assets/img/team/profile-picture-5.jpg" class="avatar-md rounded">
</div>
<div class="col ps-0 ms-2">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="h6 mb-0 text-small">Bonnie Green</h4>
</div>
<div class="text-end">
<small>2 hrs ago</small>
</div>
</div>
<p class="font-small mt-1 mb-0">New message: "We need to improve the UI/UX for the landing page."</p>
</div>
</div>
</a>
<a href="#" class="dropdown-item text-center fw-bold rounded-bottom py-3">
<svg class="icon icon-xxs text-gray-400 me-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 12a2 2 0 100-4 2 2 0 000 4z"></path><path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd"></path></svg>
View all
</a>
</div>
</div-->
</li>
<li class="nav-item dropdown ms-lg-3">
<a class="nav-link dropdown-toggle pt-1 px-0" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<div class="media d-flex align-items-center">
<img class="avatar rounded-circle" alt="Image placeholder" src="{{ user.userinfo.profile_pic_url }}">
<div class="media-body ms-2 text-dark align-items-center d-none d-lg-block">
<span class="mb-0 font-small fw-bold text-gray-900">
<strong>{{ request.user.username }}</strong>
</span>
</div>
</div>
</a>
<div class="dropdown-menu dashboard-dropdown dropdown-menu-end mt-2 py-1">
<a class="dropdown-item d-flex align-items-center" href="/account">
<svg class="dropdown-icon text-gray-400 me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-6-3a2 2 0 11-4 0 2 2 0 014 0zm-2 4a5 5 0 00-4.546 2.916A5.986 5.986 0 0010 16a5.986 5.986 0 004.546-2.084A5 5 0 0010 11z" clip-rule="evenodd"></path></svg>
My Profile
</a>
{# <a class="dropdown-item d-flex align-items-center" href="/account">#}
{# <svg class="dropdown-icon text-gray-400 me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z" clip-rule="evenodd"></path></svg>#}
{# Settings#}
{# </a>#}
{# <a class="dropdown-item d-flex align-items-center" href="#">#}
{# <svg class="dropdown-icon text-gray-400 me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M5 3a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V5a2 2 0 00-2-2H5zm0 2h10v7h-2l-1 2H8l-1-2H5V5z" clip-rule="evenodd"></path></svg>#}
{# Messages#}
{# </a>#}
{# <a class="dropdown-item d-flex align-items-center" href="#">#}
{# <svg class="dropdown-icon text-gray-400 me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-2 0c0 .993-.241 1.929-.668 2.754l-1.524-1.525a3.997 3.997 0 00.078-2.183l1.562-1.562C15.802 8.249 16 9.1 16 10zm-5.165 3.913l1.58 1.58A5.98 5.98 0 0110 16a5.976 5.976 0 01-2.516-.552l1.562-1.562a4.006 4.006 0 001.789.027zm-4.677-2.796a4.002 4.002 0 01-.041-2.08l-.08.08-1.53-1.533A5.98 5.98 0 004 10c0 .954.223 1.856.619 2.657l1.54-1.54zm1.088-6.45A5.974 5.974 0 0110 4c.954 0 1.856.223 2.657.619l-1.54 1.54a4.002 4.002 0 00-2.346.033L7.246 4.668zM12 10a2 2 0 11-4 0 2 2 0 014 0z" clip-rule="evenodd"></path></svg>#}
{# Support#}
{# </a>#}
<div role="separator" class="dropdown-divider my-1"></div>
<a class="dropdown-item d-flex align-items-center" href="/logout">
<svg class="dropdown-icon text-danger me-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg>
Logout
</a>
</div>
</li>
</ul>
</div>
</div>
</nav>

View File

@@ -0,0 +1,46 @@
<!-- Core -->
<script src="/static/assets/vendor/@popperjs/core/dist/umd/popper.min.js"></script>
<script src="/static/assets/vendor/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- Vendor JS -->
<script src="/static/assets/vendor/onscreen/dist/on-screen.umd.min.js"></script>
<!-- Slider -->
<script src="/static/assets/vendor/nouislider/distribute/nouislider.min.js"></script>
<!-- Smooth scroll -->
<script src="/static/assets/vendor/smooth-scroll/dist/smooth-scroll.polyfills.min.js"></script>
<!-- Charts -->
<script src="/static/assets/vendor/chartist/dist/chartist.min.js"></script>
<script src="/static/assets/vendor/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.min.js"></script>
<!-- Datepicker -->
<script src="/static/assets/vendor/vanillajs-datepicker/dist/js/datepicker.min.js"></script>
<!-- Sweet Alerts 2 -->
<script src="/static/assets/vendor/sweetalert2/dist/sweetalert2.all.min.js"></script>
<!-- Moment JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment.min.js"></script>
<!-- Vanilla JS Datepicker -->
<script src="/static/assets/vendor/vanillajs-datepicker/dist/js/datepicker.min.js"></script>
<!-- Notyf -->
<script src="/static/assets/vendor/notyf/notyf.min.js"></script>
<!-- Simplebar -->
<script src="/static/assets/vendor/simplebar/dist/simplebar.min.js"></script>
<!-- Github buttons -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
<!-- Volt JS -->
<script src="/static/assets/js/volt.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>

View File

@@ -0,0 +1,38 @@
<div class="theme-settings card bg-gray-800 pt-2 collapse" id="theme-settings">
<div class="card-body bg-gray-800 text-white pt-4">
<button type="button" class="btn-close theme-settings-close" aria-label="Close" data-bs-toggle="collapse"
href="#theme-settings" role="button" aria-expanded="false" aria-controls="theme-settings"></button>
<div class="d-flex justify-content-between align-items-center mb-3">
<p class="m-0 mb-1 me-4 fs-7">Open source <span role="img" aria-label="gratitude">💛</span></p>
<a class="github-button" href="https://github.com/themesberg/volt-bootstrap-5-dashboard"
data-color-scheme="no-preference: dark; light: light; dark: light;" data-icon="octicon-star"
data-size="large" data-show-count="true"
aria-label="Star themesberg/volt-bootstrap-5-dashboard on GitHub">Star</a>
</div>
<a href="https://themesberg.com/product/admin-dashboard/volt-bootstrap-5-dashboard" target="_blank"
class="btn btn-secondary d-inline-flex align-items-center justify-content-center mb-3 w-100">
Download
<svg class="icon icon-xs ms-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M2 9.5A3.5 3.5 0 005.5 13H9v2.586l-1.293-1.293a1 1 0 00-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 15.586V13h2.5a4.5 4.5 0 10-.616-8.958 4.002 4.002 0 10-7.753 1.977A3.5 3.5 0 002 9.5zm9 3.5H9V8a1 1 0 012 0v5z" clip-rule="evenodd"></path></svg>
</a>
<p class="fs-7 text-gray-300 text-center">Available in the following technologies:</p>
<div class="d-flex justify-content-center">
<a class="me-3" href="https://themesberg.com/product/admin-dashboard/volt-bootstrap-5-dashboard"
target="_blank">
<img src="/static/assets/img/technologies/bootstrap-5-logo.svg" class="image image-xs">
</a>
<a href="https://demo.themesberg.com/volt-react-dashboard/#/" target="_blank">
<img src="/static/assets/img/technologies/react-logo.svg" class="image image-xs">
</a>
</div>
</div>
</div>
<div class="card theme-settings bg-gray-800 theme-settings-expand" id="theme-settings-expand">
<div class="card-body bg-gray-800 text-white rounded-top p-3 py-2">
<span class="fw-bold d-inline-flex align-items-center h6">
<svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z" clip-rule="evenodd"></path></svg>
Settings
</span>
</div>
</div>

View File

@@ -0,0 +1,164 @@
<nav class="navbar navbar-dark navbar-theme-primary px-4 col-12 d-lg-none">
<a class="navbar-brand me-lg-5" href="/">
<img class="navbar-brand-dark" src="/static/assets/img/brand/light.svg" alt="Volt logo" /> <img class="navbar-brand-light" src="/static/assets/img/brand/dark.svg" alt="Volt logo" />
</a>
<div class="d-flex align-items-center">
<button class="navbar-toggler d-lg-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
<nav id="sidebarMenu" class="sidebar d-lg-block bg-gray-800 text-white collapse" data-simplebar>
<div class="sidebar-inner px-4 pt-3">
<div class="user-card d-flex d-md-none align-items-center justify-content-between justify-content-md-center pb-4">
<div class="d-flex align-items-center">
<div class="avatar-lg me-4">
<img src="{{ user.userinfo.profile_pic_url }}" class="card-img-top rounded-circle border-white"
alt="Bonnie Green">
</div>
<div class="d-block">
<h2 class="h5 mb-3">{{ user.userinfo }}</h2>
<a href="/logout" class="btn btn-secondary btn-sm d-inline-flex align-items-center">
<svg class="icon icon-xxs me-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg>
Sign Out
</a>
</div>
</div>
<div class="collapse-close d-md-none">
<a href="#sidebarMenu" data-bs-toggle="collapse"
data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="true"
aria-label="Toggle navigation">
<svg class="icon icon-xs" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</a>
</div>
</div>
<ul class="nav flex-column pt-3 pt-md-0">
<li class="nav-item">
<a href="/" class="nav-link d-flex align-items-center">
<span class="sidebar-icon">
<img src="/static/assets/img/brand/light.svg" height="20" width="20" alt="Volt Logo">
</span>
<span class="mt-1 ms-1 sidebar-text">Sprint</span>
</a>
</li>
{% if user.userinfo.groups %}
<li class="nav-item">
<span
class="nav-link collapsed d-flex justify-content-between align-items-center"
data-bs-toggle="collapse" data-bs-target="#submenu-groups">
<span>
<span class="sidebar-icon">
<img src="/static/assets/img/icons/users.svg" height="20" width="20" alt="Volt Logo">
</span>
<span class="sidebar-text">Группы</span>
</span>
<span class="link-arrow">
<svg class="icon icon-sm" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg>
</span>
</span>
<div class="multi-level collapse"
role="list" id="submenu-groups" aria-expanded="false">
<ul class="flex-column nav">
{% for group in user.userinfo.groups %}
<li class="nav-item">
<a class="nav-link" href="/group?group_id={{ group.id }}">
<span class="sidebar-text">{{ group.name }}</span>
</a>
</li>
{% endfor %}
</ul>
</div>
</li>
{% endif %}
<li class="nav-item">
<span
class="nav-link collapsed d-flex justify-content-between align-items-center"
data-bs-toggle="collapse" data-bs-target="#submenu-app">
<span>
<span class="sidebar-icon">
<img src="/static/assets/img/icons/tasks.svg" height="20" width="20" alt="Volt Logo">
</span>
<span class="sidebar-text">Задачи</span>
</span>
<span class="link-arrow">
<svg class="icon icon-sm" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg>
</span>
</span>
<div class="multi-level collapse"
role="list" id="submenu-app" aria-expanded="false">
<ul class="flex-column nav">
<li class="nav-item">
<a class="nav-link" href="/tasks">
<span class="sidebar-text">Все</span>
</a>
</li>
{% if user.userinfo.teacher %}
<li class="nav-item">
<a class="nav-link" href="/tasks?filter=my">
<span class="sidebar-text">Мои</span>
</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link" href="/tasks?filter=new">
<span class="sidebar-text">Новые</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/tasks?filter=unsolved">
<span class="sidebar-text">Незавершенные</span>
</a>
</li>
</ul>
</div>
</li>
<li class="nav-item">
<a href="/sets" class="nav-link">
<span class="sidebar-icon">
<img src="/static/assets/img/icons/cubes.svg" height="20" width="20" alt="Volt Logo">
</span>
<span class="sidebar-text">Сеты</span>
</a>
</li>
<li class="nav-item">
<a href="/rating" class="nav-link">
<span class="sidebar-icon">
<img src="/static/assets/img/icons/star.svg" height="20" width="20" alt="Volt Logo">
</span>
<span class="sidebar-text">Рейтинг</span>
</a>
</li>
<li role="separator" class="dropdown-divider mt-4 mb-3 border-gray-700"></li>
{# <li class="nav-item">#}
{# <a href="https://appseed.us/admin-dashboards/django-dashboard-volt" target="_blank"#}
{# class="nav-link d-flex align-items-center">#}
{# <span class="sidebar-icon">#}
{# <svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>#}
{# </span>#}
{# <span class="sidebar-text">Product Page</span>#}
{# </a>#}
{# </li>#}
{# <li class="nav-item">#}
{# <a target="_blank"#}
{# href="https://appseed.us/support"#}
{# class="nav-link d-flex align-items-center">#}
{# <span class="sidebar-icon">#}
{# <svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z" clip-rule="evenodd"></path></svg>#}
{# </span>#}
{# <span class="sidebar-text">Support</span>#}
{# </a>#}
{# </li>#}
{# <li class="nav-item">#}
{# <a target="_blank"#}
{# href="https://appseed.us/admin-dashboards/django-dashboard-volt-pro"#}
{# class="btn btn-secondary d-flex align-items-center justify-content-center btn-upgrade-pro">#}
{# <span class="sidebar-icon d-inline-flex align-items-center justify-content-center">#}
{# <svg class="icon icon-xs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M12.395 2.553a1 1 0 00-1.45-.385c-.345.23-.614.558-.822.88-.214.33-.403.713-.57 1.116-.334.804-.614 1.768-.84 2.734a31.365 31.365 0 00-.613 3.58 2.64 2.64 0 01-.945-1.067c-.328-.68-.398-1.534-.398-2.654A1 1 0 005.05 6.05 6.981 6.981 0 003 11a7 7 0 1011.95-4.95c-.592-.591-.98-.985-1.348-1.467-.363-.476-.724-1.063-1.207-2.03zM12.12 15.12A3 3 0 017 13s.879.5 2.5.5c0-1 .5-4 1.25-4.5.5 1 .786 1.293 1.371 1.879A2.99 2.99 0 0113 13a2.99 2.99 0 01-.879 2.121z" clip-rule="evenodd"></path></svg>#}
{# </span>#}
{# <span>Upgrade to Pro</span>#}
{# </a>#}
{# </li>#}
</ul>
</div>
</nav>

View File

@@ -0,0 +1,86 @@
<!--
=========================================================
* Volt Free - Bootstrap 5 Dashboard
=========================================================
* Product Page: https://themesberg.com/product/admin-dashboard/volt-premium-bootstrap-5-dashboard
* Copyright 2020 Themesberg (https://www.themesberg.com)
* License (https://themesberg.com/licensing)
* Designed and coded by https://themesberg.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Please contact us to request a removal.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Primary Meta Tags -->
<title>
Django Volt Dashboard - {% block title %}{% endblock %} | AppSeed
</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="title" content="Volt Free Bootstrap Dashboard - Sign up page">
<meta name="author" content="Themesberg">
<meta name="description" content="Volt Pro is a Premium Bootstrap 5 Admin Dashboard featuring over 800 components, 10+ plugins and 20 example pages using Vanilla JS.">
<meta name="keywords" content="bootstrap 5, bootstrap, bootstrap 5 admin dashboard, bootstrap 5 dashboard, bootstrap 5 charts, bootstrap 5 calendar, bootstrap 5 datepicker, bootstrap 5 tables, bootstrap 5 datatable, vanilla js datatable, themesberg, themesberg dashboard, themesberg admin dashboard" />
<link rel="canonical" href="https://appseed.us/admin-dashboards/django-dashboard-volt">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://demo.themesberg.com/volt-pro">
<meta property="og:title" content="Volt Free Bootstrap Dashboard - Sign up page">
<meta property="og:description" content="Volt Pro is a Premium Bootstrap 5 Admin Dashboard featuring over 800 components, 10+ plugins and 20 example pages using Vanilla JS.">
<meta property="og:image" content="https://themesberg.s3.us-east-2.amazonaws.com/public/products/volt-pro-bootstrap-5-dashboard/volt-pro-preview.jpg">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://demo.themesberg.com/volt-pro">
<meta property="twitter:title" content="Volt Free Bootstrap Dashboard - Sign up page">
<meta property="twitter:description" content="Volt Pro is a Premium Bootstrap 5 Admin Dashboard featuring over 800 components, 10+ plugins and 20 example pages using Vanilla JS.">
<meta property="twitter:image" content="https://themesberg.s3.us-east-2.amazonaws.com/public/products/volt-pro-bootstrap-5-dashboard/volt-pro-preview.jpg">
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="120x120" href="/static/assets/img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/assets/img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/assets/img/favicon/favicon-16x16.png">
<link rel="manifest" href="/static/assets/img/favicon/site.webmanifest">
<link rel="mask-icon" href="/static/assets/img/favicon/safari-pinned-tab.svg" color="#ffffff">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="theme-color" content="#ffffff">
<!-- FA Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- Sweet Alert -->
<link type="text/css" href="/static/assets/vendor/sweetalert2/dist/sweetalert2.min.css" rel="stylesheet">
<!-- Notyf -->
<link type="text/css" href="/static/assets/vendor/notyf/notyf.min.css" rel="stylesheet">
<!-- Volt CSS -->
<link type="text/css" href="/static/assets/css/volt.css" rel="stylesheet">
<!-- Specific Page JS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}
</head>
<body>
{% block content %}{% endblock content %}
{% include 'includes/scripts.html' %}
<!-- Specific Page JS goes HERE -->
{% block javascripts %}{% endblock javascripts %}
</body>
</html>

View File

@@ -0,0 +1,92 @@
<!--
=========================================================
* Volt Free - Bootstrap 5 Dashboard
=========================================================
* Product Page: https://themesberg.com/product/admin-dashboard/volt-bootstrap-5-dashboard
* Copyright 2021 Themesberg (https://www.themesberg.com)
* License (https://themesberg.com/licensing)
* Designed and coded by https://themesberg.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Please contact us to request a removal.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Primary Meta Tags -->
<title>
Django Volt Dashboard - {% block title %}{% endblock %} | AppSeed
</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="title" content="Volt - Free Bootstrap 5 Dashboard">
<meta name="author" content="Themesberg">
<meta name="description" content="Volt Pro is a Premium Bootstrap 5 Admin Dashboard featuring over 800 components, 10+ plugins and 20 example pages using Vanilla JS.">
<meta name="keywords" content="bootstrap 5, bootstrap, bootstrap 5 admin dashboard, bootstrap 5 dashboard, bootstrap 5 charts, bootstrap 5 calendar, bootstrap 5 datepicker, bootstrap 5 tables, bootstrap 5 datatable, vanilla js datatable, themesberg, themesberg dashboard, themesberg admin dashboard" />
<link rel="canonical" href="https://appseed.us/admin-dashboards/django-dashboard-volt">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://demo.themesberg.com/volt-pro">
<meta property="og:title" content="Volt - Free Bootstrap 5 Dashboard">
<meta property="og:description" content="Volt Pro is a Premium Bootstrap 5 Admin Dashboard featuring over 800 components, 10+ plugins and 20 example pages using Vanilla JS.">
<meta property="og:image" content="https://themesberg.s3.us-east-2.amazonaws.com/public/products/volt-pro-bootstrap-5-dashboard/volt-pro-preview.jpg">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://demo.themesberg.com/volt-pro">
<meta property="twitter:title" content="Volt - Free Bootstrap 5 Dashboard">
<meta property="twitter:description" content="Volt Pro is a Premium Bootstrap 5 Admin Dashboard featuring over 800 components, 10+ plugins and 20 example pages using Vanilla JS.">
<meta property="twitter:image" content="https://themesberg.s3.us-east-2.amazonaws.com/public/products/volt-pro-bootstrap-5-dashboard/volt-pro-preview.jpg">
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="120x120" href="/static/assets/img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/static/assets/img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/assets/img/favicon/favicon-16x16.png">
<link rel="manifest" href="/static/assets/img/favicon/site.webmanifest">
<link rel="mask-icon" href="/static/assets/img/favicon/safari-pinned-tab.svg" color="#ffffff">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="theme-color" content="#ffffff">
<!-- Fa icons -->
<script src="https://use.fontawesome.com/49b98aaeb5.js"></script>
<link type="text/css" href="/static/assets/vendor/sweetalert2/dist/sweetalert2.min.css" rel="stylesheet">
<link type="text/css" href="/static/assets/vendor/notyf/notyf.min.css" rel="stylesheet">
<link type="text/css" href="/static/assets/css/volt.css" rel="stylesheet">
<!-- Specific Page JS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}
</head>
<body onload="{% block onload %}{% endblock %}">
{% include 'includes/sidebar.html' %}
<main class="content">
{% include 'includes/navigation.html' %}
{% block content %}{% endblock content %}
</main>
{% include 'includes/scripts.html' %}
<!-- Specific Page JS goes HERE -->
{% block javascripts %}{% endblock javascripts %}
</body>
</html>

View File

@@ -1,105 +1,113 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block title %}Главная{% endblock %}
{% block main %}
<table>
<tr>
<td>
<h2>Мои группы</h2>
</td>
<td>
<button style="margin-left: 20px;" class="btn btn-primary" data-toggle="modal" data-target="#exampletoken"><i class="fa fa-sign-in"></i></button>
<div class="modal fade" id="exampletoken" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitletoken" 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="exampleModalLongTitletoken">Войти в группу по токену</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="hidden" name="action" value="token">
<input type="text" name="token" placeholder="Токен">
</div>
{% block stylesheets %}
<style>
td > * {
vertical-align : middle;
}
</style>
{% endblock %}
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<table>
<tr>
<td>
<h1 class="h4">Мои группы</h1>
</td>
<td>
<button type="button" class="btn btn-block btn-info mb-3" data-bs-toggle="modal" data-bs-target="#modal-enter" style="margin-left: 10px;"><img height="15" width="15" src="/static/assets/img/icons/enter-group.svg" /></button>
<div class="modal fade" id="modal-enter" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Присоединиться к группе</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="text" style="width: 100%;" name="token" placeholder="Токен">
<input type="hidden" name="action" value="token">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Войти</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</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-sign-in"></i> Войти</button>
</div>
</div>
</form>
</div>
</div>
</td>
{% if user.userinfo.can_create %}
<td>
<button style="margin-left: 20px;" class="btn btn-success" data-toggle="modal" data-target="#example"><i class="fa fa-plus"></i></button>
<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">Создать новую группу</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="Имя группы">
</td>
{% if user.userinfo.can_create %}
<td>
<button type="button" class="btn btn-block btn-success mb-3" data-bs-toggle="modal" data-bs-target="#modal-create" style="margin-left: 10px;"><img height="15" width="15" src="/static/assets/img/icons/plus.svg" /></button>
<div class="modal fade" id="modal-create" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Создать группу</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="text" style="width: 100%;" name="name" placeholder="Имя группы">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Создать</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</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>
</td>
{% endif %}
</tr>
</table>
{% for group in groups %}
<a href="/group?group_id={{ group.id }}">{{ group.name }}</a><br>
{% endfor %}
<hr><hr>
<h2>Топ задач сегодня</h2>
{% for task in top_tasks_today %}
<a href="/task?task_id={{ task.id }}">{{ task.name }} ({{ task.count }})</a>&emsp;<span class="badge badge-{{ task.solution.badge_style }}">{{ task.solution.number_result }}</span><br>
{% endfor %}
<hr><hr>
</td>
{% endif %}
</tr>
</table>
{% for group in groups %}
<a href="/group?group_id={{ group.id }}">{{ group.name }}</a><br>
{% endfor %}
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Топ задач сегодня</h1>
{% for task in top_tasks_today %}
<a href="/task?task_id={{ task.id }}">{{ task.name }} ({{ task.count }})</a> <span class="badge bg-{{ task.solution.badge_style }}">{{ task.solution.number_result }}</span><br>
{% endfor %}
</div>
</div>
{% if undone_tasks %}
<h2>У тебя были попытки, попробуй решить задачи еще раз</h2>
{% for task in undone_tasks %}
<a href="/task?task_id={{ task.id }}">{{ task.name }}</a>&emsp;<span class="badge badge-{{ task.solution.badge_style }}">{{ task.solution.number_result }}</span><br>
{% endfor %}
<hr><hr>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">У тебя были попытки, попробуй решить задачи еще раз</h1>
{% for task in undone_tasks %}
<a href="/task?task_id={{ task.id }}">{{ task.name }}</a>&emsp;<span class="badge bg-{{ task.solution.badge_style }}">{{ task.solution.number_result }}</span><br>
{% endfor %}
</div>
</div>
{% endif %}
{% if new_tasks %}
<h2>Новые задачи</h2>
{% for task in new_tasks %}
<a href="/task?task_id={{ task.id }}">{{ task.name }}</a><br>
{% endfor %}
<hr><hr>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Новые задачи</h1>
{% for task in new_tasks %}
<a href="/task?task_id={{ task.id }}">{{ task.name }}</a><br>
{% endfor %}
</div>
</div>
{% endif %}
<h2>Топ пользователей</h2>
{% for u in top_users %}
<a href="/account?username={{ u.user.username }}">{{ u.place }}. <img src="{{ u.profile_pic_url }}" width="50px" height="50px" style="border-radius: 50%; margin-right: 10px;">{{ u.user.username }} ({{ u.rating }})</a><br><br>
{% endfor %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Топ пользователей</h1>
{% for u in top_users %}
<a href="/account?username={{ u.user.username }}">{{ u.place }}. <img src="{{ u.profile_pic_url }}" width="50px" height="50px" style="border-radius: 50%; margin-right: 10px;">{{ u.user.username }} ({{ u.rating }})</a><br><br>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@@ -1,41 +1,40 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block main %}
<h4>Рейтинг</h4>
<table class="table">
<thead>
<tr>
<th scope="col" style="text-align: center; vertical-align: middle; width: 70px;">#</th>
<th scope="col" style="vertical-align: middle;">Пользователь</th>
<th scope="col" style="vertical-align: middle;">Дата регистрации</th>
<th scope="col" style="vertical-align: middle; text-align: center;">Решено задач</th>
<th scope="col" style="text-align: center; vertical-align: middle;">Рейтинг</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr {% if user == u %}style="background-color: #0000FF1E;"{% endif %}>
<td style="text-align: center; vertical-align: middle; width: 70px;">
{{ u.userinfo.place }}
</td>
<td style="vertical-align: middle; width: 800px;">
<img src="{{ u.userinfo.profile_pic_url }}" width="50px" height="50px" style="border-radius: 50%; margin-right: 10px;">
{% if u.userinfo.has_favourite_language %}
<img src="{{ u.userinfo.favourite_language.logo_url }}" width="18px" height="18px" style="margin-top: 40px; margin-left: -30px;">
{% endif %}
<a href="/account?username={{ u.username }}">{{ u.username }}</a>
</td>
<td style="vertical-align: middle;">
{{ u.date_joined.date }}
</td>
<td style="text-align: center; vertical-align: middle;">
{{ u.userinfo.tasks_solved }}
</td>
<td style="text-align: center; vertical-align: middle;">
{{ u.userinfo.rating }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<div class="table-responsive">
<table class="table table-centered table-nowrap mb-0 rounded">
<thead class="thead-light">
<tr>
<th class="border-0 rounded-start">#</th>
<th class="border-0">Пользователь</th>
<th class="border-0">Дата регистрации</th>
<th class="border-0">Решено задач</th>
<th class="border-0">Рейтинг</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<!-- Item -->
<tr>
<td>{{ u.userinfo.place }}</td>
<td class="fw-bold d-flex align-items-center">
<img src="{{ u.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;">
{# {% if u.userinfo.has_favourite_language %}#}
{# <img src="{{ u.userinfo.favourite_language.logo_url }}" width="18px" height="18px" style="margin-top: 40px; margin-left: -30px;">#}
{# {% endif %}#}
<a href="/account?username={{ u.username }}">{{ u.username }}</a>
</td>
<td>{{ u.date_joined.date }}</td>
<td>{{ u.userinfo.tasks_solved }}</td>
<td>{{ u.userinfo.rating }}</td>
</tr>
<!-- End of Item -->
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,25 +1,35 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% load filters %}
{% block title %}{{ set.name }}{% endblock %}
{% block main %}
<h3>{{ set.name }}</h3>
{% block content %}
<h1 class="h4">{{ set.name }}</h1>
<p>{{ set.description }}</p>
<h4>Таски</h4>
{% for settask in set.settasks_ordered %}
{% with result=user|solved:settask.task %}
<a href="/task?setTask_id={{ settask.id }}" style="color: {% if result %}green{% else %}{% if result == False %}red{% else %}#307df6{% endif %}{% endif %};">{{ settask.name }}. {{ settask.task.name }}</a><br>
{% endwith %}
{% endfor %}
<hr><hr>
Время начала: <b>{% if not set.start_time %}без ограничений{% else %}{{ set.start_time_moscow }}{% endif %}</b><br>
Время окончания: <b>{% if not set.end_time %}без ограничений{% else %}{{ set.end_time_moscow }}{% endif %}</b><br>
Публичность: <b>{% if set.public %}публично{% else %}приватно{% endif %}</b><br>
Открытость: <b>{% if set.opened %}открыто{% else %}закрыто{% endif %} для просмотра и решения</b><br>
<hr><hr>
{% for language in set.language_models %}
<img src="{{ language.logo_url }}" height="24px" width="24px"> {{ language.name }}<br>
{% endfor %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Таски</h1>
{% for settask in set.settasks_ordered %}
{% with result=user|solved:settask.task %}
<table><tr><td>{% if result %}<div class="bg-success dot rounded-circle"></div>{% else %}{% if result == False %}<div class="bg-danger dot rounded-circle"></div>{% else %}{% endif %}{% endif %}</td><td><a href="/task?setTask_id={{ settask.id }}">{{ settask.name }}. {{ settask.task.name }}</a></td></tr></table>
{% endwith %}
{% endfor %}
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
Время начала: <b>{% if not set.start_time %}без ограничений{% else %}{{ set.start_time_moscow }}{% endif %}</b><br>
Время окончания: <b>{% if not set.end_time %}без ограничений{% else %}{{ set.end_time_moscow }}{% endif %}</b><br>
Публичность: <b>{% if set.public %}публично{% else %}приватно{% endif %}</b><br>
Открытость: <b>{% if set.opened %}открыто{% else %}закрыто{% endif %} для просмотра и решения</b><br>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
{% for language in set.language_models %}
<img src="{{ language.logo_url }}" height="24px" width="24px"> {{ language.name }}<br>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@@ -1,209 +1,206 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block title %}{{ set.name }}{% endblock %}
{% block scripts %}
var saved_data = "";
function handle(value) {
const elem = document.getElementById(value);
elem.hidden = !elem.hidden;
}
function doPoll() {
jQuery.get('/polling/admin/checkers?set_id={{ set.id }}', function(data) {
var e = document.getElementById('checkers');
if (saved_data.length != data.length) {
saved_data = data;
e.innerHTML = data;
}
setTimeout(function() {doPoll()}, 2000);
})
}
{% block javascripts %}
<script>
var saved_data = "";
function handle(value) {
const elem = document.getElementById(value);
elem.hidden = !elem.hidden;
}
function doPoll() {
jQuery.get('/polling/admin/checkers?set_id={{ set.id }}', function(data) {
var e = document.getElementById('checkers');
if (saved_data.length !== data.length) {
saved_data = data;
e.innerHTML = data;
}
setTimeout(function() {doPoll()}, 2000);
})
}
</script>
{% endblock %}
{% block onload %}doPoll(){% endblock %}
{% block main %}
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="save">
<h3><input name="name" placeholder="Название" value="{{ set.name }}"></h3>
<textarea id="input0" style="width: 1000px; height: 400px; resize: none;" name="description" placeholder="Описание">{{ set.description }}</textarea>
<h4>Таски</h4>
{% for settask in set.settasks_ordered %}
<input name="settask_{{ settask.id }}" style="width: 30px;" value="{{ settask.name }}"> {% if settask.task.creator == user or user.username in settask.task.editors %}<a href="/admin/task?task_id={{ settask.task.id }}">{{ settask.task.name }}</a>{% else %}{{ settask.task.name }}{% endif %}<br>
{% endfor %}
<button class="btn btn-light" type="submit" style="margin-top: 20px;"><i class="fa fa-save"></i> Установить</button>&emsp;<button type="button" class="btn btn-primary" style="margin-top: 20px;" data-toggle="modal" data-target="#example"><i class="fa fa-pencil"></i> Редактировать</button>
</form>
<div class="modal fade" id="example" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
<div class="modal-dialog" role="document">
{% block scripts %}
{% endblock %}
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<form method="POST">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Редактировать набор задач</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="hidden" name="action" value="edit">
{% for task in user.userinfo.available_tasks %}
<input type="checkbox" {% if task in set.tasks %}checked{% endif %} name="task_{{ task.id }}"> <a href="/task?task_id={{ task.id }}">{{ task.name }}</a><br>
{% endfor %}
</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-check"></i> Установить</button>
</div>
</div>
{% csrf_token %}
<h4><input name="name" style="width: 1000px;" placeholder="Название" value="{{ set.name }}"></h4>
<textarea id="input0" style="width: 1000px; height: 400px; resize: none;" name="description" placeholder="Описание">{{ set.description }}</textarea><br>
<button class="btn btn-block btn-info mt-3" type="submit">Сохранить</button>
</form>
</div>
</div>
<hr><hr>
<h3>Настройки доступа</h3>
<form method="POST">
{% csrf_token %}
<input type="hidden" name="action" value="time">
Набор открыт для решения&emsp;<input type="checkbox" name="opened" {% if set.opened %}checked{% endif %}><br>
Набор доступен всем пользователям&emsp;<input type="checkbox" name="public" {% if set.public %}checked{% endif %}>
<div class="row">
<div class="col-2">
<p>
Время начала<br>
</p>
<p>
Без ограничений&emsp;<input type="checkbox" name="start_time_check" onclick="handle('start_time');" {% if not set.start_time %}checked{% endif %}>
</p>
<p id="start_time" {% if not set.start_time %}hidden{% endif %}>
<input type="datetime-local" name="start_time" value="{{ start_time }}">
</p>
</div>
<div class="col-2">
<p>
Время окончания<br>
</p>
<p>
Без ограничений&emsp;<input type="checkbox" name="end_time_check" onclick="handle('end_time')" {% if not set.end_time %}checked{% endif %}>
</p>
<p id="end_time" {% if not set.end_time %}hidden{% endif %}>
<input type="datetime-local" name="end_time" value="{{ end_time }}">
</p>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<form>
{% csrf_token %}
<h4>Таски</h4>
{% for settask in set.settasks_ordered %}
<input name="settask_{{ settask.id }}" style="width: 30px;" value="{{ settask.name }}"> {% if settask.task.creator == user or user.username in settask.task.editors %}<a href="/admin/task?task_id={{ settask.task.id }}">{{ settask.task.name }}</a>{% else %}{{ settask.task.name }}{% endif %}<br>
{% endfor %}
<button class="btn btn-block btn-info mt-3" type="submit">Установить</button>&emsp;<button type="button" class="btn btn-block btn-info mt-3" data-bs-toggle="modal" data-bs-target="#edit-tasks">Редактировать</button>
</form>
<div class="modal fade" id="edit-tasks" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать набор задач</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="edit">
{% for task in user.userinfo.available_tasks %}
<input type="checkbox" {% if task in set.tasks %}checked{% endif %} name="task_{{ task.id }}"> <a href="/task?task_id={{ task.id }}">{{ task.name }}</a><br>
{% endfor %}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Установить</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</div>
</div>
<button class="btn btn-light"><i class="fa fa-save"></i> Сохранить</button>
</form>
<hr><hr>
<h3>Редакторы</h3>
{% for editor in set.editors %}
<i class="fa fa-user"></i> <a href="/account?username={{ editor }}">{{ editor }}</a><br>
{% endfor %}
<button type="button" class="btn btn-primary" style="margin-top: 20px;" data-toggle="modal" data-target="#exampleU"><i class="fa fa-pencil"></i> Редактировать</button>
<div class="modal fade" id="exampleU" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitleU" aria-hidden="true">
<div class="modal-dialog" role="document">
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Настройки доступа</h1>
<form method="POST">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitleU">Редактировать редакторов таска</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
{% csrf_token %}
<input type="hidden" name="action" value="time">
Набор открыт для решения&emsp;<input type="checkbox" name="opened" {% if set.opened %}checked{% endif %}><br>
Набор доступен всем пользователям&emsp;<input type="checkbox" name="public" {% if set.public %}checked{% endif %}>
<div class="row">
<div class="col-2">
<p>
Время начала<br>
</p>
<p>
Без ограничений&emsp;<input type="checkbox" name="start_time_check" onclick="handle('start_time');" {% if not set.start_time %}checked{% endif %}>
</p>
<p id="start_time" {% if not set.start_time %}hidden{% endif %}>
<input type="datetime-local" name="start_time" value="{{ start_time }}">
</p>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-12">
{% csrf_token %}
<input type="hidden" name="action" value="users_edit">
{% for u in user.userinfo.verified_friends %}
<input type="checkbox" {% if u.username in set.editors %}checked{% endif %} name="user_{{ u.username }}"> <a href="/account?username={{ u.username }}">{{ u.username }}</a><br>
{% endfor %}
</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-check"></i> Установить</button>
<div class="col-2">
<p>
Время окончания<br>
</p>
<p>
Без ограничений&emsp;<input type="checkbox" name="end_time_check" onclick="handle('end_time')" {% if not set.end_time %}checked{% endif %}>
</p>
<p id="end_time" {% if not set.end_time %}hidden{% endif %}>
<input type="datetime-local" name="end_time" value="{{ end_time }}">
</p>
</div>
</div>
<button class="btn btn-block btn-info mt-3" type="submit">Сохранить</button>
</form>
</div>
</div>
<hr><hr>
<h3>Языки программирования</h3>
{% for language in set.language_models %}
<img src="{{ language.logo_url }}" height="24px" width="24px"> {{ language.name }}<br>
{% endfor %}
<button type="button" class="btn btn-primary" style="margin-top: 20px;" data-toggle="modal" data-target="#exampleL"><i class="fa fa-pencil"></i> Редактировать</button>
<div class="modal fade" id="exampleL" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitleL" 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="exampleModalLongTitleL">Редактировать языки программирования</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="hidden" name="action" value="languages_edit">
<input type="checkbox" name="auto_add" {% if set.auto_add_new_languages %}checked{% endif %}> Обновлять список при добавлении нового языка<br>
{% for language in languages %}
<input type="checkbox" {% if language.id in set.languages %}checked{% endif %} name="language_{{ language.id }}"> <img src="{{ language.logo_url }}" height="24px" width="24px"> {{ language.name }}<br>
{% endfor %}
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Редакторы</h1>
{% for editor in set.editors %}
<i class="fa fa-user"></i> <a href="/account?username={{ editor }}">{{ editor }}</a><br>
{% endfor %}
<button type="button" class="btn btn-block btn-info mt-3" data-bs-toggle="modal" data-bs-target="#edit-users">Редактировать</button>
<div class="modal fade" id="edit-users" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать редакторов сета</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</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-check"></i> Установить</button>
<div class="modal-body">
<input type="hidden" name="action" value="users_edit">
{% for u in user.userinfo.verified_friends %}
<input type="checkbox" {% if u.username in set.editors %}checked{% endif %} name="user_{{ u.username }}"> <a href="/account?username={{ u.username }}">{{ u.username }}</a><br>
{% endfor %}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Установить</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</div>
<hr><hr>
<h3>Чекеры</h3>
<div id="checkers"></div>
<button class="btn btn-light" data-toggle="modal" data-target="#exampleCheckers"><i class="fa fa-plus"></i> Добавить чекер</button>
<div class="modal fade" id="exampleCheckers" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitleCheckers" 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="exampleModalLongTitleCheckers">Создать новый чекер</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="hidden" name="action" value="new_checker">
<input type="text" name="name" placeholder="Имя чекера">
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Языки программирования</h1>
{% for language in set.language_models %}
<img src="{{ language.logo_url }}" height="24px" width="24px"> {{ language.name }}<br>
{% endfor %}
<button type="button" class="btn btn-block btn-info mt-3" data-bs-toggle="modal" data-bs-target="#edit-languages">Редактировать</button>
<div class="modal fade" id="edit-languages" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать языки программирования</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</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 class="modal-body">
<input type="hidden" name="action" value="languages_edit">
<input type="checkbox" name="auto_add" {% if set.auto_add_new_languages %}checked{% endif %}> Обновлять список при добавлении нового языка<br>
{% for language in languages %}
<input type="checkbox" {% if language.id in set.languages %}checked{% endif %} name="language_{{ language.id }}"> <img src="{{ language.logo_url }}" height="24px" width="24px"> {{ language.name }}<br>
{% endfor %}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Установить</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Чекеры</h1>
<div id="checkers"></div>
<button type="button" class="btn btn-block btn-info mt-3" data-bs-toggle="modal" data-bs-target="#edit-checkers">Добавить чекер</button>
<div class="modal fade" id="edit-checkers" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Создать новый чекер</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="new_checker">
<input type="text" name="name" style="width: 100%;" placeholder="Имя чекера">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Создать</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -1,49 +1,45 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block title %}сеты{% endblock %}
{% block main %}
<table>
<tr>
<td>
<h2>Сеты</h2>
</td>
{% if user.userinfo.can_create %}
<td>
<button style="margin-left: 20px;" class="btn btn-success" data-toggle="modal" data-target="#example"><i class="fa fa-plus"></i></button>
<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">Создать новый сет</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="Название сета">
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<table>
<tr>
<td>
<h1 class="h4">Сеты</h1>
</td>
{% if user.userinfo.can_create %}
<td>
<button type="button" class="btn btn-block btn-success mb-3" data-bs-toggle="modal" data-bs-target="#modal-create" style="margin-left: 10px;"><img height="15" width="15" src="/static/assets/img/icons/plus.svg" /></button>
<div class="modal fade" id="modal-create" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Создать сет</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="text" style="width: 100%;" name="name" placeholder="Название сета">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Создать</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</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>
</td>
{% endif %}
</tr>
</table>
{% for set in user.userinfo.available_sets %}
<a href="/set?set_id={{ set.id }}">{{ set.name }}</a> {% if set.creator == user or user.username in set.editors %}<a href="/admin/set?set_id={{ set.id }}"><i class="fa fa-pencil"></i> </a><a href="/solutions?set_id={{ set.id }}"><i class="fa fa-stack-overflow"></i> </a>{% endif %}<br>
{% endfor %}
</td>
{% endif %}
</tr>
</table>
{% for set in user.userinfo.available_sets %}
<a href="/set?set_id={{ set.id }}">{{ set.name }}</a> {% if set.creator == user or user.username in set.editors %}<a href="/admin/set?set_id={{ set.id }}"><i class="fa fa-pencil"></i> </a><a href="/solutions?set_id={{ set.id }}"><i class="fa fa-stack-overflow"></i> </a>{% endif %}<br>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@@ -1,85 +1,99 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% load filters %}
{% block main %}
<h4>
<table class="table" style="width: 50%;">
<tr>
<td>
Id решения
</td>
<td>
{{ solution.id }}
</td>
</tr>
<tr>
<td>
Пользователь
</td>
<td>
<a href="/account?username={{ solution.user.username }}"><img src="{{ solution.user.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;">{{ solution.user.username }}</a>
</td>
</tr>
<tr>
<td>
Задача
</td>
<td>
<a href="/task?{% if solution.set %}{% with settask=solution.set|settask:solution.task %}setTask_id={{ settask.id }}{% endwith %}{% else %}task_id={{ solution.task.id }}{% endif %}">{{ solution.task.name }}</a>
</td>
</tr>
<tr>
<td>
Время отправки
</td>
<td>
{{ solution.time_sent }}
</td>
</tr>
<tr>
<td>
Язык
</td>
<td>
<img src="{{ solution.language.logo_url }}" width="30px" height="30px"> {{ solution.language.name }}
</td>
</tr>
<tr>
<td>
Результат
</td>
<td>
<span class="badge badge-{% if solution.result == in_queue_status %}secondary{% else %}{% if solution.result == ok_status %}success{% else %}{% if solution.result|startswith:testing_status %}info{% else %}danger{% endif %}{% endif %}{% endif %}">{% if solution.result == testing_status %}<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle-notch" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 20px;" class="svg-inline--fa fa-circle-notch fa-w-16 fa-spin fa-lg"><path fill="currentColor" d="M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z" class=""></path></svg> {% endif %}{{ solution.result }}</span>
</td>
</tr>
</table>
</h4>
<hr><hr>
<h4>Файлы решения</h4>
{% for entity in solution.files %}
<h5>{{ entity.filename }}</h5>
<pre><code class="{{ entity.highlight }}" style="border: 1px solid black;">{{ entity.text }}</code></pre>
<hr><hr>
{% endfor %}
{% block javascripts %}
<link rel="stylesheet"
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
{% if solution.task.creator == user or user.username in solution.task.editors or solution.set and solution.set.creator == user or solution.set and user.username in solution.set.editors %}
<h4>Лог тестрования</h4>
{% for key, value in solution.extras.items %}
<h5>Тест {{ key }}</h5>
Затраченное время: {{ value.time_spent }} мс
<div class="row">
<div class="col-4" style="background-color: #DDDDDD;">
Ожидаемый вывод:<br>
{{ value.predicted }}
</div>
<div class="col-4"></div>
<div class="col-4" style="background-color: #DDDDDD;">
Фактический вывод:<br>
{{ value.output }}
</div>
</div>
<hr>
{% endfor %}
{% endif %}
{% endblock %}
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h4>
<table class="table" style="width: 50%;">
<tr>
<td>
Id решения
</td>
<td>
{{ solution.id }}
</td>
</tr>
<tr>
<td>
Пользователь
</td>
<td>
<a href="/account?username={{ solution.user.username }}"><img src="{{ solution.user.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;">{{ solution.user.username }}</a>
</td>
</tr>
<tr>
<td>
Задача
</td>
<td>
<a href="/task?{% if solution.set %}{% with settask=solution.set|settask:solution.task %}setTask_id={{ settask.id }}{% endwith %}{% else %}task_id={{ solution.task.id }}{% endif %}">{{ solution.task.name }}</a>
</td>
</tr>
<tr>
<td>
Время отправки
</td>
<td>
{{ solution.time_sent }}
</td>
</tr>
<tr>
<td>
Язык
</td>
<td>
<img src="{{ solution.language.logo_url }}" width="30px" height="30px"> {{ solution.language.name }}
</td>
</tr>
<tr>
<td>
Результат
</td>
<td>
<span class="badge bg-{% if solution.result == in_queue_status %}secondary{% else %}{% if solution.result == ok_status %}success{% else %}{% if solution.result|startswith:testing_status %}info{% else %}danger{% endif %}{% endif %}{% endif %}">{% if solution.result == testing_status %}<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle-notch" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 20px;" class="svg-inline--fa fa-circle-notch fa-w-16 fa-spin fa-lg"><path fill="currentColor" d="M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z" class=""></path></svg> {% endif %}{{ solution.result }}</span>
</td>
</tr>
</table>
</h4>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
{% for entity in solution.files %}
<h5>{{ entity.filename }}</h5>
<pre><code class="{{ entity.highlight }}" style="border: 1px solid black;">{{ entity.text }}</code></pre>
{% endfor %}
</div>
</div>
{% if solution.task.creator == user or user.username in solution.task.editors or solution.set and solution.set.creator == user or solution.set and user.username in solution.set.editors %}
{% for key, value in solution.extras.items %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h6">Тест {{ key }}</h1>
Затраченное время: {{ value.time_spent }} мс
<div class="row">
<div class="col-4" style="background-color: #DDDDDD;">
Ожидаемый вывод:<br>
{{ value.predicted }}
</div>
<div class="col-4"></div>
<div class="col-4" style="background-color: #DDDDDD;">
Фактический вывод:<br>
{{ value.output }}
</div>
</div>
</div>
</div>
{% endfor %}
{% endif %}
{% endblock %}

View File

@@ -1,70 +1,72 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block scripts %}
var look = 0;
var page = 1;
function setLook(number) {
look = number;
var n = number.toString();
var butid = 'button' + n;
document.getElementById(butid).classList.add('btn-dark');
document.getElementById(butid).classList.remove('btn-light');
document.getElementById(butid).focused = false;
butid = 'button' + (1 - number).toString();
document.getElementById(butid).classList.remove('btn-dark');
document.getElementById(butid).classList.add('btn-light');
document.getElementById(butid).focused = false;
}
function setPage(number) {
page = number;
}
function doPoll() {
jQuery.get('/polling/solutions_table?{{ query }}&teacher=true&page=' + page.toString() + '&look=' + look.toString(), function(data) {
var e = document.getElementById('solutions');
if (e.innerHTML !== data)
e.innerHTML = data;
const name = "page_num_" + page.toString();
elem = document.getElementById(name);
if (elem) {
elem.className = "btn btn-dark";
}
setTimeout(function() {doPoll()}, 2000);
})
}
{% block javascripts %}
<script>
var look = 0;
var page = 1;
function setLook(number) {
look = number;
var n = number.toString();
var butid = 'button' + n;
document.getElementById(butid).classList.add('btn-primary');
document.getElementById(butid).classList.remove('btn-gray');
document.getElementById(butid).focused = false;
butid = 'button' + (1 - number).toString();
document.getElementById(butid).classList.remove('btn-primary');
document.getElementById(butid).classList.add('btn-gray');
document.getElementById(butid).focused = false;
}
function setPage(number) {
page = number;
}
function setNext() {
page += 1;
}
function setPrev() {
page -= 1;
}
function doPoll() {
jQuery.get('/polling/solutions_table?{{ query }}&teacher=true&page=' + page.toString() + '&look=' + look.toString(), function(data) {
var e = document.getElementById('solutions');
if (e.innerHTML !== data)
e.innerHTML = data;
if (look === 0) {
const pagesCount = parseInt(document.getElementById('page_count').value);
if (pagesCount !== 1) {
const name = "page_num_" + page.toString();
const elem = document.getElementById(name);
if (elem) {
elem.className = "page-item active";
}
if (page === 1) {
document.getElementById("page_prev").style = "display: none;";
}
if (page === pagesCount) {
document.getElementById("page_next").style = "display: none;";
}
}
}
setTimeout(function() {doPoll()}, 2000);
})
}
</script>
{% endblock %}
{% block onload %}doPoll(){% endblock %}
{% block main %}
<h2>Решения <a href="{% if in_set %}/set?set_id={{ set.id }}{% else %}/task?task_id={{ task.id }}{% endif %}">{% if in_set %}{{ set.name }}{% else %}{{ task.name }}{% endif %}</a></h2>
{% if in_set %}
<table style="margin-bottom: 10px;">
<tr>
<td><button class="btn btn-dark" id="button0" onclick="setLook(0)">Список</button></td>
<td><button class="btn btn-light" id="button1" onclick="setLook(1)">Таблица</button></td>
</tr>
</table>
{% endif %}
<!--h4>Фильтр</h4>
<div>
<select name="set_id" style="width: 33%">
<option value="0">Все сеты</option>
{% for set in user.userinfo.available_sets %}
<option value="{{ set.id }}" {% if set.id == set_id %}selected{% endif %}>{{ set.name }}</option>
{% endfor %}
</select>
<select name="set_id" style="width: 33%">
<option value="0">Все таски</option>
{% for task in user.userinfo.available_tasks %}
<option value="{{ task.id }}" {% if task.id == task_id %}selected{% endif %}>{{ task.name }}</option>
{% endfor %}
</select>
<select name="set_id" style="width: 33%">
<option value="0">Все пользователи</option>
{% for u in users %}
<option value="{{ user.username }}" {% if user.username == username %}selected{% endif %}>{{ user.userinfo }}</option>
{% endfor %}
</select>
</div-->
<div id="solutions"></div>
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Решения <a href="{% if in_set %}/set?set_id={{ set.id }}{% else %}/task?task_id={{ task.id }}{% endif %}">{% if in_set %}{{ set.name }}{% else %}{{ task.name }}{% endif %}</a></h1>
{% if in_set %}
<table style="margin-bottom: 10px;">
<tr>
<td><button class="btn btn-primary" id="button0" onclick="setLook(0)">Список</button></td>
<td><button class="btn btn-gray" id="button1" onclick="setLook(1)">Таблица</button></td>
</tr>
</table>
{% endif %}
<div class="table-responsive" id="solutions"></div>
</div>
</div>
{% endblock %}

View File

@@ -1,54 +1,61 @@
<table class="table" style="margin-top: 30px;">
<thead>
<th scope="col">id</th>
<th scope="col">Пользователь</th>
<th scope="col">Задача</th>
<th scope="col">Время отправки</th>
<th scope="col">Язык</th>
<th scope="col">Результат</th>
</thead>
<tbody>
{% for solution in solutions %}
<tr>
<td>
<b><a href="/solution?solution_id={{ solution.id }}">{{ solution.id }}</a></b>
</td>
<td>
<img src="{{ solution.user.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;"><a href="/account?username={{ solution.user.username }}">{{ solution.user }}</a>
</td>
<td>
<a href="/task?task_id={{ solution.task.id }}">{{ solution.task.name }}</a>
</td>
<td>
{{ solution.time_sent }}
</td>
<td>
<img src="{{ solution.language.logo_url }}" width="30px" height="30px">
{{ solution.language.name }}
</td>
<td>
<h4>
{% if solution.result == testing_status %}
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: {{ solution.percentage_done }}%"></div>
</div>
{% else %}
<span class="badge badge-{{ solution.badge_style }}">{{ solution.number_result }}</span>
{% endif %}
</h4>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<table class="table table-centered table-nowrap mb-0 rounded" style="margin-top: 30px;">
<thead class="thead-light">
<th class="border-0 rounded-start">id</th>
<th class="border-0">Пользователь</th>
<th class="border-0">Задача</th>
<th class="border-0">Время отправки</th>
<th class="border-0">Язык</th>
<th class="border-0 rounded-end">Результат</th>
</thead>
<tbody>
{% for solution in solutions %}
<tr>
<td>
<b><a href="/solution?solution_id={{ solution.id }}">{{ solution.id }}</a></b>
</td>
<td>
<img src="{{ solution.user.userinfo.profile_pic_url }}" width="30px" height="30px" style="border-radius: 50%; margin-right: 10px;"><a href="/account?username={{ solution.user.username }}">{{ solution.user }}</a>
</td>
<td>
<a href="/task?task_id={{ solution.task.id }}">{{ solution.task.name }}</a>
</td>
<td>
{{ solution.time_sent }}
</td>
<td>
<img src="{{ solution.language.logo_url }}" width="30px" height="30px">
{{ solution.language.name }}
</td>
<td>
<h5>
{% if solution.result == testing_status %}
<div class="progress">
<div class="progress-bar bg-info" role="progressbar" style="width: {{ solution.percentage_done }}%;"></div>
</div>
{% else %}
<span class="badge bg-{{ solution.badge_style }}">{{ solution.number_result }}</span>
{% endif %}
</h5>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<input type="hidden" id="page_count" value="{{ pages }}">
{% if need_pagination %}
<div style="display: flex; justify-content: flex-end">
<table>
<tr>
<nav aria-label="Page navigation example" style="display: flex; justify-content: flex-end; margin-top: 20px;">
<ul class="pagination mb-0">
<li class="page-item" id="page_prev">
<a class="page-link" href="#" onclick="setPrev()">Previous</a>
</li>
{% for num in count_pages %}
<td><button class="btn btn-light" id="page_num_{{ num }}" onclick="setPage({{ num }})">{{ num }}</button></td>
<li class="page-item" id="page_num_{{ num }}">
<a class="page-link" href="#" onclick="setPage({{ num }})">{{ num }}</a>
</li>
{% endfor %}
</tr>
</table>
</div>
<li class="page-item" id="page_next">
<a class="page-link" href="#" onclick="setNext()">Next</a>
</li>
</ul>
</nav>
{% endif %}

View File

@@ -1,10 +1,10 @@
{% load filters %}
<table class="table-bordered" style="margin-top: 30px; table-layout: fixed; width: 100%;">
<thead>
<th scope="col"></th>
<table class="table table-flush" style="margin-top: 30px; table-layout: fixed; width: 100%;">
<thead class="thead-light">
<th></th>
{% for task in set.settasks_ordered %}
<th style="text-align: center;" scope="col">{{ task.name }}</th>
<th style="text-align: center;">{{ task.name }}</th>
{% endfor %}
</thead>
<tbody>
@@ -16,15 +16,15 @@
{% with pair=user.id|make_pair:task.id %}
{% with result=data|get_info:pair %}
{% if result == in_queue_status %}
<span class="badge badge-secondary">{{ result }}</span>
<span class="badge bg-secondary">{{ result }}</span>
{% else %}{% if result == ok_status %}
<span class="badge badge-success">{{ result }}</span>
<span class="badge bg-success">{{ result }}</span>
{% else %}{% if result|startswith:testing_status %}
<span class="badge badge-info">{{ result }}</span>
<span class="badge bg-info">{{ result }}</span>
{% else %}{% if result %}
<span class="badge badge-danger">{{ result }}</span>
<span class="badge bg-danger">{{ result }}</span>
{% else %}
<span class="badge badge-warning">-</span>
<span class="badge bg-warning">-</span>
{% endif %}{% endif %}{% endif %}{% endif %}
{% endwith %}
{% endwith %}

View File

@@ -1,153 +1,195 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% load filters %}
{% block title %}{{ task.name }}{% endblock %}
{% block scripts %}
function change(num) {
inp = document.getElementById('soltype');
if (inp.value == num) return;
document.getElementById('button' + inp.value).classList.remove('btn-dark');
document.getElementById('button' + inp.value).classList.add('btn-light');
document.getElementById('button' + inp.value).focused = false;
document.getElementById('input' + inp.value).hidden = true;
inp.value = 1 - inp.value;
document.getElementById('button' + inp.value).classList.remove('btn-light');
document.getElementById('button' + inp.value).classList.add('btn-dark');
document.getElementById('button' + inp.value).focused = false;
document.getElementById('input' + inp.value).hidden = false;
document.getElementById('chosen').hidden = true;
document.getElementById('file-upload').value = null;
document.getElementById('input0').value = "";
}
var page = 1;
function setPage(number) {
page = number;
}
function doPoll() {
jQuery.get('/polling/solutions_table?{% if in_set %}setTask_id={{ setTask.id }}{% else %}task_id={{ task.id }}{% endif %}&page=' + page.toString(), function(data) {
var e = document.getElementById('solutions');
if (e.innerHTML !== data)
e.innerHTML = data;
const name = "page_num_" + page.toString();
elem = document.getElementById(name);
if (elem) {
elem.className = "btn btn-dark";
}
jQuery.get('/task_runtime?task_id={{ task.id }}', function(data1) {
document.getElementById('runtime').innerHTML = data1;
setTimeout(function() {doPoll()}, 2000);
{% block javascripts %}
<script type="text/javascript" id="MathJax-script"
async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<script>
function change(num) {
inp = document.getElementById('soltype');
if (inp.value == num) return;
document.getElementById('button' + inp.value).classList.remove('btn-primary');
document.getElementById('button' + inp.value).classList.add('btn-gray-100');
document.getElementById('button' + inp.value).focused = false;
document.getElementById('input' + inp.value).hidden = true;
inp.value = 1 - inp.value;
document.getElementById('button' + inp.value).classList.remove('btn-gray-100');
document.getElementById('button' + inp.value).classList.add('btn-primary');
document.getElementById('button' + inp.value).focused = false;
document.getElementById('input' + inp.value).hidden = false;
document.getElementById('chosen').hidden = true;
document.getElementById('file-upload').value = null;
document.getElementById('input0').value = "";
}
var page = 1;
function setPage(number) {
page = number;
}
function setNext() {
page += 1;
}
function setPrev() {
page -= 1;
}
function doPoll() {
jQuery.get('/polling/solutions_table?{% if in_set %}setTask_id={{ setTask.id }}{% else %}task_id={{ task.id }}{% endif %}&page=' + page.toString(), function(data) {
var e = document.getElementById('solutions');
if (e.innerHTML !== data)
e.innerHTML = data;
const pagesCount = parseInt(document.getElementById('page_count').value);
if (pagesCount !== 1) {
const name = "page_num_" + page.toString();
const elem = document.getElementById(name);
if (elem) {
elem.className = "page-item active";
}
if (page === 1) {
document.getElementById("page_prev").style = "display: none;";
}
if (page === pagesCount) {
document.getElementById("page_next").style = "display: none;";
}
}
jQuery.get('/task_runtime?task_id={{ task.id }}', function(data1) {
document.getElementById('runtime').innerHTML = data1;
setTimeout(function() {doPoll()}, 2000);
})
})
})
}
}
</script>
{% endblock %}
{% block onload %}doPoll(){% endblock %}
{% block main %}
{% block content %}
<div id="runtime"></div>
<div class="row">
<div class="col">
{% if task.legend %}
<h4>Легенда</h4>
{% autoescape off %}
{{ task.legend }}
{% endautoescape %}
<hr>
{% endif %}
{% if task.input_format %}
<h4>Формат входных данных</h4>
{% autoescape off %}
{{ task.input_format }}
{% endautoescape %}
<hr>
{% endif %}
{% if task.output_format %}
<h4>Формат выходных данных</h4>
{% autoescape off %}
{{ task.output_format }}
{% endautoescape %}
<hr>
{% endif %}
{% if task.specifications %}
<h4>Примечания</h4>
{% autoescape off %}
{{ task.specifications }}
{% endautoescape %}
<hr>
{% endif %}
{% if task.samples %}
<h4 style="">Примеры</h4>
{% for sample in task.samples %}
<h5>Пример {{ sample.num }}</h5>
<b>
<table style="width: 100%">
<tr>
<td>
Входные данные
</td>
<td>
Выходные данные
</td>
</tr>
</table>
</b>
<hr>
<table style="width: 100%;">
<tr>
<td style="width: 50%; vertical-align: top;">
<pre>
{{ sample.input }}
</pre>
</td>
<td style="width: 50%; vertical-align: top;">
<pre>
{{ sample.output }}
</pre>
</td>
</tr>
</table>
<hr>
{% endfor %}
{% endif %}
</div>
{% if in_set %}
<div class="col-2">
<h5><a href="/set?set_id={{ set.id }}">{{ set.name }}</a></h5>
{% for settask in setTask.set.settasks_ordered %}
{% with result=user|solved:settask.task %}
<a href="/task?setTask_id={{ settask.id }}" style="color: {% if result %}green{% else %}{% if result == False %}red{% else %}#307df6{% endif %}{% endif %};">{% if task == settask.task %}<b>{% endif %}{{ settask.name }}. {{ settask.task.name }}{% if task == settask.task %}</b>{% endif %}</a><br>
{% endwith %}
{% endfor %}
<div class="row">
<div class="col">
{% if task.legend %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Легенда</h1>
{% autoescape off %}
{{ task.legend }}
{% endautoescape %}
</div>
</div>
{% endif %}
{% if task.input_format %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Формат входных данных</h1>
{% autoescape off %}
{{ task.input_format }}
{% endautoescape %}
</div>
</div>
{% endif %}
{% if task.output_format %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Формат выходных данных</h1>
{% autoescape off %}
{{ task.output_format }}
{% endautoescape %}
</div>
</div>
{% endif %}
{% if task.specifications %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Примечания</h1>
{% autoescape off %}
{{ task.specifications }}
{% endautoescape %}
</div>
</div>
{% endif %}
{% if task.samples %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Примеры</h1>
{% for sample in task.samples %}
<h1 class="h6">Пример {{ sample.num }}</h1>
<b>
<table style="width: 100%">
<tr>
<td>
Входные данные
</td>
<td>
Выходные данные
</td>
</tr>
</table>
</b>
<hr>
<table style="width: 100%;">
<tr>
<td style="width: 50%; vertical-align: top;">
<pre>{{ sample.input }}</pre>
</td>
<td style="width: 50%; vertical-align: top;">
<pre>{{ sample.output }}</pre>
</td>
</tr>
</table>
<hr>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% if in_set %}
<div class="col-2">
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h5><a href="/set?set_id={{ set.id }}">{{ set.name }}</a></h5>
{% for settask in setTask.set.settasks_ordered %}
{% with result=user|solved:settask.task %}
<table><tr><td>{% if result %}<div class="bg-success dot rounded-circle"></div>{% else %}{% if result == False %}<div class="bg-danger dot rounded-circle"></div>{% else %}{% endif %}{% endif %} </td><td><a href="/task?setTask_id={{ settask.id }}">{% if task == settask.task %}<b>{% endif %}{{ settask.name }}. {{ settask.task.name }}{% if task == settask.task %}</b>{% endif %}</a></td></tr></table>
{% endwith %}
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Отправить решение</h1>
<table style="margin-bottom: 10px;">
<tr>
<input type="hidden" form="solform" name="action" id="soltype" value="0">
<td><button class="btn btn-primary" id="button0" onclick="change('0')">Текст</button></td>
<td><button class="btn btn-gray-100" id="button1" onclick="change('1')">Файл</button></td>
</tr>
</table>
<form method="POST" enctype="multipart/form-data" id="solform">
{% csrf_token %}
<select name="language" style="margin-bottom: 30px; width: 25%;">
<option disabled>Выберите язык</option>
{% for lang in languages %}
<option value="{{ lang.id }}"{% if user.userinfo.favourite_language_id == lang.id %} selected{% endif %}>{{ lang }}</option>
{% endfor %}
</select><br>
<textarea id="input0" style="width: 100%; height: 400px; resize: none;" name="code" placeholder="Вставьте сюда свой код"></textarea>
<label for="file-upload" class="btn btn-outline-dark" id="input1" hidden>
<i class="fa fa-upload"></i> Загрузить файл
</label>
<p id="chosen" hidden>Файл выбран</p>
<input type="file" style="display: none;" onchange="document.getElementById('chosen').hidden = false;" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file">
<br><button type="submit" style="margin-top: 30px; margin-bottom: 30px;" class="btn btn-gray-100">Отправить</button>
</form>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Решения</h1>
<div id="solutions" class="table-responsive"></div>
</div>
</div>
{% endif %}
</div>
<h2>Отправить решение</h2>
<table style="margin-bottom: 10px;">
<tr>
<input type="hidden" form="solform" name="action" id="soltype" value="0">
<td><button class="btn btn-dark" id="button0" onclick="change('0')">Текст</button></td>
<td><button class="btn btn-light" id="button1" onclick="change('1')">Файл</button></td>
</tr>
</table>
<form method="POST" enctype="multipart/form-data" id="solform">
{% csrf_token %}
<select name="language" style="margin-bottom: 30px; width: 10%;">
<option disabled>Выберите язык</option>
{% for lang in languages %}
<option value="{{ lang.id }}"{% if user.userinfo.favourite_language_id == lang.id %} selected{% endif %}>{{ lang }}</option>
{% endfor %}
</select><br>
<textarea id="input0" style="width: 1000px; height: 400px; resize: none;" name="code" placeholder="Вставьте сюда свой код"></textarea>
<label for="file-upload" class="btn btn-outline-dark" id="input1" hidden>
<i class="fa fa-upload"></i> Загрузить файл
</label>
<p id="chosen" hidden>Файл выбран</p>
<input type="file" style="display: none;" onchange="document.getElementById('chosen').hidden = false;" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file">
<br><button type="submit" style="margin-top: 30px; margin-bottom: 30px;" class="btn btn-dark">Отправить</button>
</form>
<hr>
<h2>Решения</h2>
<div id="solutions"></div>
{% endblock %}

View File

@@ -1 +1 @@
<h2>{{ task.name }}{% if task.creator == user or user.username in task.editors %}<a href="/admin/task?task_id={{ task.id }}"><i class="fa fa-pencil"></i></a>{% endif %}<span style="margin-left: 15px;" class="badge badge-{% if progress.finished %}success{% else %}danger{% endif %}">{{ progress.time }}</span></h2>
<h2>{{ task.name }}{% if task.creator == user or user.username in task.editors %}<a href="/admin/task?task_id={{ task.id }}"><i class="fa fa-pencil"></i></a>{% endif %}<span style="margin-left: 15px;" class="badge bg-{% if progress.finished %}success{% else %}danger{% endif %}">{{ progress.time }}</span></h2>

View File

@@ -1,354 +1,307 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block title %}{{ task.name }}{% endblock %}
{% load filters %}
{% block scripts %}
function deleteFile(file_id) {
$.ajax({
type: "POST",
url: "/admin/task?task_id={{ task.id }}",
data: {"id": file_id, "csrfmiddlewaretoken": document.getElementsByName("csrfmiddlewaretoken")[0].value, "action": "delete_file"},
success: function(data) {
if (data == "ok") {
var elem = document.getElementById("file_" + file_id);
elem.parentNode.removeChild(elem);
{% block javascripts %}
<script>
function deleteFile(file_id) {
$.ajax({
type: "POST",
url: "/admin/task?task_id={{ task.id }}",
data: {"id": file_id, "csrfmiddlewaretoken": document.getElementsByName("csrfmiddlewaretoken")[0].value, "action": "delete_file"},
success: function(data) {
if (data === "ok") {
const elem = document.getElementById("file_" + file_id);
elem.parentNode.removeChild(elem);
}
}
}
});
}
function setActionCreate(action) {
document.getElementById('action_create').value = action;
}
});
}
</script>
{% endblock %}
{% block main %}
{% block content %}
<h3 style="margin-bottom: 40px;">Настройки задачи <a data-toggle="modal" data-target="#exampleModalLongcheck"><i class="fa fa-eye"></i></a></h3>
<div class="modal fade bd-example-modal-lg" id="exampleModalLongcheck" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitlecheck" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitlecheck">Предпросмотр</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">
<iframe src="/task?task_id={{ task.id }}" style="width: 100%; height: 1000px;" embedded=true></iframe>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> Закрыть</button>
<input id="action_create" type="hidden" name="action" value="">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-9">
<form method="POST">
{% csrf_token %}
<table style="width: 100%;">
<tr>
<td style="width: 250px;">
Название задачи
</td>
<td>
<h4><input type="text" value="{{ task.name }}" name="name" class="task-settings-input" placeholder="Новая задача"></h4>
</td>
</tr>
<tr>
<td>
Легенда
</td>
<td>
<textarea class="task-settings-input task-settings-textarea" name="legend">{{ task.legend }}</textarea>
</td>
</tr>
<tr>
<td>
Формат входных данных
</td>
<td>
<textarea class="task-settings-input task-settings-textarea" name="input_format">{{ task.input_format }}</textarea>
</td>
</tr>
<tr>
<td>
Формат выходных данных
</td>
<td>
<textarea class="task-settings-input task-settings-textarea" name="output_format">{{ task.output_format }}</textarea>
</td>
</tr>
<tr>
<td>
Примечания
</td>
<td>
<textarea class="task-settings-input task-settings-textarea" name="specifications">{{ task.specifications }}</textarea>
</td>
</tr>
<tr>
<td>
Ограничение по времени (мс)
</td>
<td>
<input type="text" name="time_limit" value="{{ task.time_limit }}" class="task-settings-input">
</td>
</tr>
<tr>
<td>
Оценка времени решения (мин)
</td>
<td>
<input type="text" name="time_estimation" value="{{ task.time_estimation }}" class="task-settings-input">
</td>
</tr>
<tr>
<td>
Публичная задача
</td>
<td>
<input type="checkbox" name="public" {% if task.public %}checked {% endif %}class="task-settings-input">
</td>
</tr>
</table>
<button type="submit" class="btn btn-light" style="margin-top: 15px;"><i class="fa fa-save"></i> Сохранить</button>
</form>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<form method="POST">
{% csrf_token %}
<table style="width: 100%;">
<tr>
<td style="width: 250px;">
Название задачи
</td>
<td>
<h4><input type="text" value="{{ task.name }}" name="name" style="width: 100%;" placeholder="Новая задача"></h4>
</td>
</tr>
<tr>
<td>
Легенда
</td>
<td>
<textarea style="width: 100%; height: 200px;" name="legend">{{ task.legend }}</textarea>
</td>
</tr>
<tr>
<td>
Формат входных данных
</td>
<td>
<textarea style="width: 100%; height: 200px;" name="input_format">{{ task.input_format }}</textarea>
</td>
</tr>
<tr>
<td>
Формат выходных данных
</td>
<td>
<textarea style="width: 100%; height: 200px;" name="output_format">{{ task.output_format }}</textarea>
</td>
</tr>
<tr>
<td>
Примечания
</td>
<td>
<textarea style="width: 100%; height: 200px;" name="specifications">{{ task.specifications }}</textarea>
</td>
</tr>
<tr>
<td>
Ограничение по времени (мс)
</td>
<td>
<input type="text" name="time_limit" value="{{ task.time_limit }}" style="width: 100%;">
</td>
</tr>
<tr>
<td>
Оценка времени решения (мин)
</td>
<td>
<input type="text" name="time_estimation" value="{{ task.time_estimation }}" style="width: 100%;">
</td>
</tr>
<tr>
<td>
Публичная задача
</td>
<td>
<input type="checkbox" name="public" {% if task.public %}checked {% endif %}>
</td>
</tr>
</table>
<button type="submit" class="btn btn-info" style="margin-top: 15px;">Сохранить</button>
</form>
</div>
</div>
</div>
<div class="col-3">
<h5>История изменений</h5>
{% for change in task.changes %}
<div>
<hr>
<a href="/account?username={{ change.username }}">{{ change.username }}</a>: {{ change.time }}<br>
{{ change.action }}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h5>История изменений</h5>
{% for change in task.changes %}
<div>
<hr>
<a href="/account?username={{ change.username }}">{{ change.username }}</a>: {{ change.time }}<br>
{{ change.action }}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
<hr><hr>
<h3>Редакторы</h3>
{% for editor in task.editors %}
<i class="fa fa-user"></i> <a href="/account?username={{ editor }}">{{ editor }}</a><br>
{% endfor %}
<button type="button" class="btn btn-primary" style="margin-top: 20px;" data-toggle="modal" data-target="#exampleU"><i class="fa fa-pencil"></i> Редактировать</button>
<div class="modal fade" id="exampleU" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitleU" 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="exampleModalLongTitleU">Редактировать редакторов таска</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Редакторы</h1>
{% for editor in task.editors %}
<i class="fa fa-user"></i> <a href="/account?username={{ editor }}">{{ editor }}</a><br>
{% endfor %}
<button type="button" class="btn btn-block btn-info mt-3" data-bs-toggle="modal" data-bs-target="#edit-users">Редактировать</button>
<div class="modal fade" id="edit-users" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать редакторов задачи</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="users_edit">
{% for u in user.userinfo.verified_friends %}
<input type="checkbox" {% if u.username in task.editors %}checked{% endif %} name="user_{{ u.username }}"> <a href="/account?username={{ u.username }}">{{ u.username }}</a><br>
{% endfor %}
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Установить</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-12">
{% csrf_token %}
<input type="hidden" name="action" value="users_edit">
{% for u in user.userinfo.verified_friends %}
<input type="checkbox" {% if u.username in task.editors %}checked{% endif %} name="user_{{ u.username }}"> <a href="/account?username={{ u.username }}">{{ u.username }}</a><br>
{% endfor %}
</div>
</div>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Загрузка тестов и файлов</h1>
<p style="color: red">{{ error_message }}</p>
<table style="width: 80%;">
<tr>
<td>
<h1 class="h6">Тесты</h1>
</td>
<td>
<h1 class="h6">Файлы</h1>
</td>
</tr>
<tr>
<td valign="top">
{% for test in task.tests %}
<div id="file_{{ test.id }}">
<i class="fa fa-file"></i> <button class="btn btn-link" {% if not test.readable %}style="color: red;" {% else %}data-bs-toggle="modal" data-bs-target="#edit-test-{{ test.id }}"{% endif %}>{{ test.filename }}</button><button class="btn btn-link" style="color: black;" onclick="deleteFile({{ test.id }});"><i class="fa fa-times"></i> </button><br>
{% if test.readable %}
<div class="modal fade" id="edit-test-{{ test.id }}" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать тест {{ test.filename }}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input name="action" value="save_test" type="hidden">
<input name="test_id" value="{{ test.id }}" type="hidden">
<textarea style="width: 100%; height: 800px;" name="text">{{ test.text }}</textarea>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Сохранить</button>
{% if test.can_be_sample %} Использовать как пример <input type="checkbox" name="is_sample" {% if test.is_sample %}checked{% endif %}>{% endif %}
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</div>
{% endif %}
</div>
{% endfor %}
<input type="file" style="display: none;" form="form_test_upload" onchange="this.form.submit();" class="btn form-control-file" id="test-upload" value="Выбрать файл" name="file">
<label for="test-upload" class="btn btn-info">Загрузить тесты</label><button style="margin-left: 10px; margin-top: -8px; color: white;" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#create-test"><i class="fa fa-plus"></i></button>
<div class="modal fade" id="create-test" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Создать тест</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="create_test">
<input style="width: 100%;" type="text" placeholder="Имя теста" name="newfile_name">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Создать</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</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-check"></i> Установить</button>
</div>
</div>
</td>
<td valign="top">
{% for test in task.files %}
<div id="file_{{ test.id }}">
<i class="fa {% if test.filename == "checker.py" or test.filename|startswith:'Dockerfile' %}fa-cogs{% else %}fa-file{% endif %}"></i> <button class="btn btn-link" {% if not test.readable %}style="color: red;" {% else %}data-bs-toggle="modal" data-bs-target="#edit-file-{{ test.id }}"{% endif %}>{{ test.filename }}</button><button class="btn btn-link" style="color: black;" onclick="deleteFile({{ test.id }});"><i class="fa fa-times"></i> </button><br>
{% if test.readable %}
<div class="modal fade" id="edit-file-{{ test.id }}" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Редактировать файл {{ test.filename }}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input name="action" value="save_test" type="hidden">
<input name="test_id" value="{{ test.id }}" type="hidden">
<textarea style="width: 100%; height: 800px;" name="text">{{ test.text }}</textarea>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Сохранить</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</div>
{% endif %}
</div>
{% endfor %}
<input type="file" style="display: none;" form="form_file_upload" onchange="this.form.submit();" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file">
<label for="file-upload" class="btn btn-info">Загрузить файлы</label><button style="margin-left: 10px; margin-top: -8px; color: white;" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#create-file"><i class="fa fa-plus"></i></button>
<div class="modal fade" id="create-file" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Создать файл</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="create_file">
<input style="width: 100%;" type="text" placeholder="Имя файла" name="newfile_name">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Создать</button>
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="card border-0 shadow mb-4">
<div class="card-body">
<h1 class="h4">Дампы</h1>
<div class="table-responsive">
<table class="table table-centered table-nowrap mb-0 rounded">
<thead class="thead-light">
<th class="border-0 rounded-start">Id дампа</th>
<th class="border-0">Время запроса</th>
<th class="border-0">Инициатор</th>
<th class="border-0 rounded-end">Готовность</th>
</thead>
<tbody>
{% for dump in task.dumps %}
<tr>
<td>{{ dump.id }}</td>
<td>{{ dump.timestamp }}</td>
<td>{{ dump.executor.username }}</td>
<td>{% if dump.ready %}<a href="/download_file?dump_id={{ dump.id }}">Скачать</a>{% else %}<badge class="badge bg-info"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle-notch" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 20px;" class="svg-inline--fa fa-circle-notch fa-w-16 fa-spin fa-lg"><path fill="currentColor" d="M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z" class=""></path></svg> В процессе</badge>{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<form method="POST">
{% csrf_token %}
<button type="submit" name="action" value="dump" class="btn btn-primary mt-3"><i class="fa fa-arrow-right"></i> Создать дамп</button>
</form>
</div>
</div>
<hr><hr>
<h3 style="margin-bottom: 40px;">Загрузка тестов и файлов</h3>
<p style="color: red">{{ error_message }}</p>
<table style="width: 80%;">
<tr>
<td>
<h4>Тесты</h4>
</td>
<td>
<h4>Файлы</h4>
</td>
</tr>
<tr>
<td valign="top">
{% for test in task.tests %}
<div id="file_{{ test.id }}">
<i class="fa fa-file"></i> <button class="btn btn-link" {% if not test.readable %}style="color: red;" {% else %}data-toggle="modal" data-target="#filesModalLong{{ test.id }}"{% endif %}>{{ test.filename }}</button><button class="btn btn-link" style="color: black;" onclick="deleteFile({{ test.id }});"><i class="fa fa-times"></i> </button><br>
{% if test.readable %}
<form method="POST">{% csrf_token %}
<!-- Modal -->
<div class="modal fade bd-example-modal-lg" id="filesModalLong{{ test.id }}" tabindex="-1" role="dialog" aria-labelledby="filesModalLongTitle{{ test.id }}" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="filesModalLongTitle{{ test.id }}">{{ test.filename }}</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">
<textarea cols="82" rows="30" name="text">{{ test.text }}</textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
{% if test.can_be_sample %}Использовать как пример <input type="checkbox" name="is_sample" {% if test.is_sample %}checked{% endif %}>{% endif %}
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
<input name="action" value="save_test" type="hidden">
<input name="test_id" value="{{ test.id }}" type="hidden">
<button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> Save</button>
</div>
</div>
</div>
</div>
</form>
{% endif %}
{% endfor %}
<input type="file" style="display: none;" form="form_test_upload" onchange="this.form.submit();" class="btn form-control-file" id="test-upload" value="Выбрать файл" name="file">
<label for="test-upload" class="btn btn-primary"><i class="fa fa-upload"></i> Загрузить тесты</label><button style="margin-left: 10px; margin-top: -8px;" class="btn btn-success" data-toggle="modal" data-target="#exampleModalLongnewtest" onclick="setActionCreate('create_test');"><i class="fa fa-plus"></i></button>
<form method="POST">
{% csrf_token %}
<div class="modal fade" id="exampleModalLongnewtest" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitlenewtest" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitlenewtest">Создать новый тест</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">
<input type="text" placeholder="Имя теста" name="newfile_name">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> Закрыть</button>
<button type="submit" class="btn btn-success"><i class="fa fa-file"></i> Создать</button>
<input id="action_create" type="hidden" name="action" value="create_test">
</div>
</div>
</div>
</div>
</form>
</td>
<td valign="top">
{% for test in task.files %}
<div id="file_{{ test.id }}">
<i class="fa {% if test.filename == "checker.py" or test.filename|startswith:'Dockerfile' %}fa-cogs{% else %}fa-file{% endif %}"></i> <button class="btn btn-link" {% if not test.readable %}style="color: red;" {% else %}data-toggle="modal" data-target="#filesModalLong{{ test.id }}"{% endif %}>{{ test.filename }}</button><button class="btn btn-link" style="color: black;" onclick="deleteFile({{ test.id }});"><i class="fa fa-times"></i> </button><br>
{% if test.readable %}
<form method="POST">{% csrf_token %}
<!-- Modal -->
<div class="modal fade bd-example-modal-lg" id="filesModalLong{{ test.id }}" tabindex="-1" role="dialog" aria-labelledby="filesModalLongTitle{{ test.id }}" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="filesModalLongTitle{{ test.id }}">{{ test.filename }}</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">
<textarea cols="82" rows="30" name="text">{{ test.text }}</textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
{% if test.can_be_sample %}Использовать как пример <input type="checkbox" name="is_sample" {% if test.is_sample %}checked{% endif %}>{% endif %}
<button type="button" class="btn btn-secondary" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>
<input name="action" value="save_test" type="hidden">
<input name="test_id" value="{{ test.id }}" type="hidden">
<button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> Save</button>
</div>
</div>
</div>
</div>
</form>
{% endif %}
</div>
{% endfor %}
<input type="file" style="display: none;" form="form_file_upload" onchange="this.form.submit();" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file">
<label for="file-upload" class="btn btn-primary"><i class="fa fa-upload"></i> Загрузить файлы</label><button style="margin-left: 10px; margin-top: -8px;" class="btn btn-success" data-toggle="modal" data-target="#exampleModalLongnewfile" onclick="setActionCreate('create_file');"><i class="fa fa-plus"></i></button>
<form method="POST">
{% csrf_token %}
<div class="modal fade" id="exampleModalLongnewfile" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitlenewfile" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitlenewfile">Создать новый файл</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">
<input type="text" placeholder="Имя файла" name="newfile_name">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> Закрыть</button>
<button type="submit" class="btn btn-success"><i class="fa fa-file"></i> Создать</button>
<input id="action_create" type="hidden" name="action" value="create_file">
</div>
</div>
</div>
</div>
</form>
</td>
</tr>
</table>
<hr><hr>
<h3>Дампы</h3>
<table class="table">
<thead>
<th scope="col">Id дампа</th>
<th scope="col">Время запроса</th>
<th scope="col">Инициатор</th>
<th scope="col">Готовность</th>
</thead>
<tbody>
{% for dump in task.dumps %}
<tr>
<td>{{ dump.id }}</td>
<td>{{ dump.timestamp }}</td>
<td>{{ dump.executor.username }}</td>
<td>{% if dump.ready %}<a href="/download_file?dump_id={{ dump.id }}">Скачать</a>{% else %}<badge class="badge badge-info"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="circle-notch" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 20px;" class="svg-inline--fa fa-circle-notch fa-w-16 fa-spin fa-lg"><path fill="currentColor" d="M288 39.056v16.659c0 10.804 7.281 20.159 17.686 23.066C383.204 100.434 440 171.518 440 256c0 101.689-82.295 184-184 184-101.689 0-184-82.295-184-184 0-84.47 56.786-155.564 134.312-177.219C216.719 75.874 224 66.517 224 55.712V39.064c0-15.709-14.834-27.153-30.046-23.234C86.603 43.482 7.394 141.206 8.003 257.332c.72 137.052 111.477 246.956 248.531 246.667C393.255 503.711 504 392.788 504 256c0-115.633-79.14-212.779-186.211-240.236C302.678 11.889 288 23.456 288 39.056z" class=""></path></svg> В процессе</badge>{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
<form method="POST">
{% csrf_token %}
<button type="submit" name="action" value="dump" class="btn btn-primary"><i class="fa fa-arrow-right"></i> Создать дамп</button>
</form>
{% endblock %}

View File

@@ -1,61 +1,56 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block title %}Задачи{% endblock %}
{% load filters %}
{% block main %}
{% block content %}
<div class="card border-0 shadow mb-4">
<div class="card-body">
<table>
<tr>
<td>
<h2>Задачи</h2>
<h1 class="h4">Задачи</h1>
</td>
{% if user.userinfo.can_create %}
<td>
<button style="margin-left: 20px;" class="btn btn-success" data-toggle="modal" data-target="#example"><i class="fa fa-plus"></i></button>
<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">Создать новую задачу</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="Название задачи">
<button type="button" class="btn btn-block btn-success mb-3" data-bs-toggle="modal" data-bs-target="#modal-create" style="margin-left: 10px;"><img height="15" width="15" src="/static/assets/img/icons/plus.svg" /></button>
<div class="modal fade" id="modal-create" tabindex="-1" aria-labelledby="modal-default" style="display: none;" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="POST">
{% csrf_token %}
<div class="modal-header">
<h2 class="h6 modal-title">Создать задачу</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<input type="text" style="width: 100%;" name="name" placeholder="Имя задачи">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-secondary">Создать</button>
<label for="file-upload" class="btn btn-info">
Загрузить архив
</label>
<input type="file" form="fileform" style="display: none;" accept=".zip" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file" onchange="this.form.submit();">
<button type="button" class="btn btn-link text-gray-600 ms-auto" data-bs-dismiss="modal">Закрыть</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<label for="file-upload" class="btn btn-primary">
<i class="fa fa-arrow-up"></i> Загрузить архив
</label>
<input type="file" form="fileform" style="display: none;" accept=".zip" class="btn form-control-file" id="file-upload" value="Выбрать файл" name="file" onchange="this.form.submit();">
<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>
</td>
<form method="POST" enctype="multipart/form-data" id="fileform">
<input type="hidden" name="action" value="upload_file">
{% csrf_token %}
</form>
<input type="hidden" name="action" value="upload_file">
{% csrf_token %}
</form>
{% endif %}
</tr>
</table>
{% for task in user.userinfo.available_tasks %}
{% for task in tasks %}
{% with result=user|solved:task %}
<a href="/task?task_id={{ task.id }}" style="color: {% if result %}green{% else %}{% if result == False %}red{% else %}#307df6{% endif %}{% endif %};">{{ task.name }}</a> {% if task.creator == user or user.username in task.editors %}<a href="/admin/task?task_id={{ task.id }}"><i class="fa fa-pencil"></i> </a><a href="/solutions?task_id={{ task.id }}"><i class="fa fa-stack-overflow"></i> </a>{% endif %}<br>
<table><tr><td>{% if result %}<div class="bg-success dot rounded-circle"></div>{% else %}{% if result == False %}<div class="bg-danger dot rounded-circle"></div>{% else %}{% endif %}{% endif %}</td><td><a href="/task?task_id={{ task.id }}">{{ task.name }}</a></td>{% if task.creator == user or user.username in task.editors %}<td><a href="/admin/task?task_id={{ task.id }}"><i class="fa fa-pencil"></i> </a><a href="/solutions?task_id={{ task.id }}"><i class="fa fa-stack-overflow"></i> </a></td>{% endif %}</tr></table>
{% endwith %}
{% endfor %}
</div></div>
{% endblock %}

View File

@@ -1,9 +1,11 @@
{% extends 'base_main.html' %}
{% extends 'layouts/base.html' %}
{% block scripts %}
function onLoad() {
window.location.href = window.location.href.replace('#', '?');
}
{% block javascripts %}
<script>
function onLoad() {
window.location.href = window.location.href.replace('#', '?');
}
</script>
{% endblock %}
{% block onload %}onLoad(){% endblock %}