90 lines
5.1 KiB
HTML
90 lines
5.1 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% block title %}Админка{% endblock %}
|
|
|
|
{% block styles %}
|
|
.form {
|
|
margin-bottom: 15px;
|
|
}
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
function change() {
|
|
let surname = document.getElementById('surname').value;
|
|
let name = document.getElementById('name').value;
|
|
let middle_name = document.getElementById('middle_name').value;
|
|
let group = document.getElementById('group').value;
|
|
let email = document.getElementById('email').value;
|
|
let invite = document.getElementById('inviteButton');
|
|
console.log(surname + ' ' + name + ' ' + middle_name + ' ' + group + ' ' + email);
|
|
let dis = surname == '' || name == '' || middle_name == '' || group == '' || email == '' || email.indexOf('@') == -1 || email.indexOf('.') == -1 || email.indexOf('.') < email.indexOf('@');
|
|
console.log(dis);
|
|
invite.disabled = dis;
|
|
}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<h2>Доступные курсы</h2>
|
|
{% for key, value in blocks.items %}
|
|
<h5>{{ key.name }}</h5>
|
|
{% for block in value %}
|
|
<a href="/admin/block?id={{ block.id }}">{{ block.name }}</a><br>
|
|
{% endfor %}
|
|
{% if is_teacher %}
|
|
<button type="button" class="btn btn-dark" data-toggle="modal" data-target="#example_{{ key.id }}" style="margin-top: 20px;">
|
|
<i class="fa fa-plus-circle"></i> Новый блок
|
|
</button>
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="example_{{ key.id }}" 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">Новый блок в курсе {{ key.name }}</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
{% csrf_token %}
|
|
<input type="text" name="name" placeholder="Имя блока">
|
|
<input type="hidden" name="course_id" value="{{ key.id }}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times-circle"></i> Закрыть</button>
|
|
<button type="submit" class="btn btn-success"><i class="fa fa-plus-circle"></i> Создать</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<button class="btn btn-dark" onclick="window.location.href = '/admin/users_settings?course_id={{ key.id }}'" style="margin-top: 20px;"><i class="fa fa-users"></i> Участники курса</button>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if is_superuser %}
|
|
<h3 style="margin-top: 30px;">Пригласить пользователя</h3>
|
|
<form method="POST">
|
|
{% csrf_token %}
|
|
<input name="surname" placeholder="Фамилия" class="form" id="surname" onchange="change();"><br>
|
|
<input name="name" placeholder="Имя" class="form" id="name" onchange="change();"><br>
|
|
<input name="middle_name" placeholder="Отчество" class="form" id="middle_name" onchange="change();"><br>
|
|
<input name="group" placeholder="Группа" class="form" id="group" onchange="change();"><br>
|
|
<input name="email" placeholder="Почта" class="form" id="email" onchange="change();"><br>
|
|
<button type="submit" id='inviteButton' name="invite" value="Пригласить" class="btn btn-dark" disabled>Пригласить</button>
|
|
</form>
|
|
<div>
|
|
<center>
|
|
<button target="_blank" rel="noopener noreferrer" type="submit" class="btn btn-dark" onclick="window.location.href = '/admin/'" value="Django admin"><i class="fa fa-shield"></i> Django admin</button>
|
|
</center>
|
|
</div>
|
|
{% endif %}
|
|
<center>
|
|
<button class="btn btn-dark" style="margin-top: 20px;" onclick="window.location.href='/admin/docs'"><i class="fa fa-file"></i> Методичка</button>
|
|
</center>
|
|
{% endblock %} |