Refactor exam scores user template to implement question filtering by score selection
This commit is contained in:
@@ -11,18 +11,9 @@
|
|||||||
<div class="small text-muted">Filter questions by marks</div>
|
<div class="small text-muted">Filter questions by marks</div>
|
||||||
<div>
|
<div>
|
||||||
<select id="filter-score" class="form-select form-select-sm" style="min-width:120px;">
|
<select id="filter-score" class="form-select form-select-sm" style="min-width:120px;">
|
||||||
$("#hide-viewer").on('click', function(){ $('.viewer-block .viewer-body').toggle(); });
|
<option value="all">All scores</option>
|
||||||
|
<option value="2">2 (full)</option>
|
||||||
// Filter questions by score
|
<option value="1">1</option>
|
||||||
$("#filter-score").on('change', function(){
|
|
||||||
const val = $(this).val();
|
|
||||||
$(".list-group-item[data-score]").each(function(){
|
|
||||||
const s = $(this).data('score');
|
|
||||||
if(val === 'all' || String(s) === String(val)) $(this).show(); else $(this).hide();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".view-question-link").on("click", function (e) {
|
|
||||||
<option value="0">0</option>
|
<option value="0">0</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,7 +46,6 @@
|
|||||||
<div class="text-end ms-3">
|
<div class="text-end ms-3">
|
||||||
{% if exam.publish_results %}
|
{% if exam.publish_results %}
|
||||||
<button type="button" class="btn btn-sm btn-outline-primary view-question-button" data-qn={{forloop.counter0}}>View</button>
|
<button type="button" class="btn btn-sm btn-outline-primary view-question-button" data-qn={{forloop.counter0}}>View</button>
|
||||||
<button type="button" class="btn btn-sm btn-outline-primary view-question-link" data-qn={{forloop.counter0}}>View</button>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary" disabled>View</button>
|
<button type="button" class="btn btn-sm btn-outline-secondary" disabled>View</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -120,6 +110,15 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#hide-viewer").on('click', function(){ $('.viewer-block .viewer-body').toggle(); });
|
$("#hide-viewer").on('click', function(){ $('.viewer-block .viewer-body').toggle(); });
|
||||||
|
|
||||||
|
// Filter questions by score
|
||||||
|
$("#filter-score").on('change', function(){
|
||||||
|
const val = $(this).val();
|
||||||
|
$(".list-group-item[data-score]").each(function(){
|
||||||
|
const s = $(this).data('score');
|
||||||
|
if(val === 'all' || String(s) === String(val)) $(this).show(); else $(this).hide();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$(".view-question-button").on("click", function (e) {
|
$(".view-question-button").on("click", function (e) {
|
||||||
question_number = e.currentTarget.dataset.qn;
|
question_number = e.currentTarget.dataset.qn;
|
||||||
$("#single-dicom-viewer").empty();
|
$("#single-dicom-viewer").empty();
|
||||||
|
|||||||
Reference in New Issue
Block a user