SOITA/templates/editTest.html
Hubert Jankowski d9ad2c2f9d test visibility
2022-04-09 13:02:21 +02:00

130 lines
5.4 KiB
HTML

{# <div class="editContainerSection">#}
{# <div class="editContainerLine">#}
{# <label for="name"><h2>Nazwa:</h2></label>#}
{# <input id="name" type="text" name="name" value="{{ test.name }}">#}
{# </div>#}
{# </div>#}
{#{% extends "base.html" %}#}
{#{% load rest_framework %}#}
{##}
{#{% block title %}{{ test.name }} - Edytuj{% endblock %}#}
{##}
{#{% block additional_head %}#}
{# <meta charset="UTF-8">#}
{#{% endblock %}#}
{##}
{#{% block content %}#}
{# <div class="editContainer">#}
{# <form method="post" novalidate>#}
{##}
{# {% for question in test.questions.all %}#}
{# <div class="editContainerSection">#}
{# <div class="editContainerLine">#}
{# <label for="desc"><b>Opis:</b></label>#}
{# <input id="desc" type="text" name="desc", value="{{ question.description }}">#}
{# </div>#}
{# {% for answer in question.answers.all %}#}
{# <div class="editContainerLine">#}
{# <label for="ans-{{ forloop.counter }}">Odpowiedź {{ forloop.counter }}: </label>#}
{# <input id="ans-{{ forloop.counter }}" type="text" name="ans-{{ forloop.counter }}", value="{{ answer.description }}">#}
{# </div>#}
{# {% endfor %}#}
{# <div class="editContainerLine">#}
{# <label for="category">Poprawna: </label>#}
{# <select name="category" id="category">#}
{# <option value="1">1</option>#}
{# <option value="2">2</option>#}
{# <option value="3">3</option>#}
{# <option value="4">4</option>#}
{# </select>#}
{# </div>#}
{# </div>#}
{# {% endfor %}#}
{# <div class="testContent">#}
{# <input type="submit" value="Zapisz test">#}
{# <a href="/tests/{{test.id}}/add-question">Dodaj pytanie</a>#}
{# <a href="/tests/{{test.id}}/remove-question">Usun pytanie</a>#}
{# </div>#}
{# </form>#}
{# </div>#}
{#{% endblock %}#}
{##}
{% extends "base.html" %}
{% load rest_framework %}
{% block title %}{{ test.name }}{% endblock %}
{% block additional_head %}
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<style>
.test_title {
font-size: 40px;
}
.test_body {
width: 50%;
}
.question_title {
font-size: 20px;
}
</style>
{% endblock %}
{% block content %}
<div class="card" style="border: none;">
<div class="card-body test_body">
<div class="editContainerSection">
<div class="editContainerLine">
<label for="name"><h2>Nazwa:</h2></label>
<input id="name" type="text" name="name" value="{{ test.name }}">
<button class="defaultButton">
<a href='' onclick="this.href='editName?name='+document.getElementById('name').value">Zmien nazwe</a>
</button>
</div>
<label for="actual_visible">Aktualna widzialność: {% if test.visible %}Publiczny{% else %}Prywatny{% endif %}</label><br>
<label for="visible">Widzialność: </label>
<select name="visible" id="visible">
<option value="public">Publiczny</option>
<option value="private">Prywatny</option>
</select>
<button class="defaultButton">
<a href='' onclick="this.href='editVisible?visible='+document.getElementById('visible').value">Zmien widzialność testu</a>
</button>
</div>
<form method="post" novalidate>
{% for question in test.questions.all %}
<div class="question_title" style="padding-top:15px; padding-bottom:10px; padding-left:5px;">
{{ question.description }}
<input class="form-check-input me-1" type="radio" name="id" value={{ question.id }}>
</div>
<div class="list-group">
{% for answer in question.answers.all %}
<label class="list-group-item">
{{ answer.description }}
</label>
{% endfor %}
</div>
{% endfor %}
<div class="testContent">
<input type="submit" value="Edytuj wybrane pytanie">
<button class="defaultButton">
<a href="/tests/{{test.id}}/add-question">Dodaj pytanie</a>
</button>
<button class="defaultButton">
<a href="/tests/{{test.id}}/remove-question">Usuwanie pytań</a>
</button>
</div>
</form>
</div>
</div>
{% endblock %}