Refactor personal exam creation section for improved readability and structure
This commit is contained in:
@@ -59,37 +59,37 @@
|
||||
})();
|
||||
</script>
|
||||
|
||||
<hr/>
|
||||
<hr/>
|
||||
|
||||
<div class="mt-3">
|
||||
<h5>Create your personal exam</h5>
|
||||
<p>Generate a personal SBA exam from the filtered question bank. Optionally limit the number of questions.</p>
|
||||
<div class="mt-3">
|
||||
<h5>Create your personal exam</h5>
|
||||
<p>Generate a personal SBA exam from the filtered question bank. Optionally limit the number of questions.</p>
|
||||
|
||||
<form id="create-exam-form" method="post" action="{% url 'sbas:exam_create_from_filters' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="category" id="create-category" />
|
||||
<input type="hidden" name="status" id="create-status" />
|
||||
<div class="mb-2">
|
||||
<label for="create-count" class="form-label">Number of questions (0 = all)</label>
|
||||
<input type="number" name="count" id="create-count" class="form-control" min="0" value="0" />
|
||||
</div>
|
||||
<button id="create-exam-btn" type="button" class="btn btn-success">Create my exam</button>
|
||||
</form>
|
||||
</div>
|
||||
<form id="create-exam-form" method="post" action="{% url 'sbas:exam_create_from_filters' %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="category" id="create-category" />
|
||||
<input type="hidden" name="status" id="create-status" />
|
||||
<div class="mb-2">
|
||||
<label for="create-count" class="form-label">Number of questions (0 = all)</label>
|
||||
<input type="number" name="count" id="create-count" class="form-control" min="0" value="0" />
|
||||
</div>
|
||||
<button id="create-exam-btn" type="button" class="btn btn-success">Create my exam</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
const createBtn = document.getElementById('create-exam-btn');
|
||||
createBtn.addEventListener('click', function(){
|
||||
const categoryEl = document.getElementById('id_category');
|
||||
const statusEl = document.getElementById('id_status');
|
||||
const createCat = document.getElementById('create-category');
|
||||
const createStatus = document.getElementById('create-status');
|
||||
if (categoryEl) createCat.value = categoryEl.value || '';
|
||||
if (statusEl) createStatus.value = statusEl.value || '';
|
||||
document.getElementById('create-exam-form').submit();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
(function(){
|
||||
const createBtn = document.getElementById('create-exam-btn');
|
||||
createBtn.addEventListener('click', function(){
|
||||
const categoryEl = document.getElementById('id_category');
|
||||
const statusEl = document.getElementById('id_status');
|
||||
const createCat = document.getElementById('create-category');
|
||||
const createStatus = document.getElementById('create-status');
|
||||
if (categoryEl) createCat.value = categoryEl.value || '';
|
||||
if (statusEl) createStatus.value = statusEl.value || '';
|
||||
document.getElementById('create-exam-form').submit();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user