164 lines
7.3 KiB
HTML
164 lines
7.3 KiB
HTML
{% extends "admin/components/datatable.html" %}
|
|
{% block title %} SKA Referee Test | Upload Questions {% endblock %}
|
|
{% block content %}
|
|
{% include "admin/components/client-alerts.html" %}
|
|
<h1>Manage Question Datasets</h1>
|
|
{% if data %}
|
|
<table id="question-datasets-table" class="table table-striped" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
|
|
</th>
|
|
<th data-priority="1">
|
|
Name
|
|
</th>
|
|
<th data-priority="2">
|
|
Updated
|
|
</th>
|
|
<th data-priority="3">
|
|
Author
|
|
</th>
|
|
<th data-priority="3">
|
|
Exams
|
|
</th>
|
|
<th data-priority="1">
|
|
Actions
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for element in data %}
|
|
<tr class="table-row">
|
|
<td>
|
|
{% if element.default %}
|
|
<div class="text-success" title="Default Dataset">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi success bi-caret-right-fill" viewBox="0 0 16 16">
|
|
<path d="m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"/>
|
|
</svg>
|
|
</div>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{{ element.get_name() }}
|
|
</td>
|
|
<td>
|
|
{{ element.date.strftime('%d %b %Y %H:%M') }}
|
|
</td>
|
|
<td>
|
|
{{ element.creator.get_username() }}
|
|
</td>
|
|
<td>
|
|
{{ element.tests|length }}
|
|
</td>
|
|
<td class="row-actions">
|
|
<a
|
|
href="javascript:void(0)"
|
|
class="btn btn-success edit-question-dataset {% if not element.entries %} disabled {% endif %}"
|
|
data-id="{{ element.id }}"
|
|
data-action="analyse"
|
|
title="Analyse Answers"
|
|
>
|
|
<i class="bi bi-search button-icon"></i>
|
|
</a>
|
|
<a
|
|
href="javascript:void(0)"
|
|
class="btn btn-primary edit-question-dataset"
|
|
data-id="{{ element.id }}"
|
|
data-action="download"
|
|
title="Download Questions"
|
|
>
|
|
<i class="bi bi-cloud-arrow-down-fill button-icon"></i>
|
|
</a>
|
|
<a
|
|
href="javascript:void(0)"
|
|
class="btn btn-primary edit-question-dataset"
|
|
data-id="{{ element.id }}"
|
|
data-action="view"
|
|
title="View Questions"
|
|
>
|
|
<i class="bi bi-file-earmark-text-fill button-icon"></i>
|
|
</a>
|
|
<a
|
|
href="javascript:void(0)"
|
|
class="btn btn-primary edit-question-dataset"
|
|
data-id="{{ element.id }}"
|
|
data-action="edit"
|
|
title="Edit Questions"
|
|
>
|
|
<i class="bi bi-pencil-fill button-icon"></i>
|
|
</a>
|
|
<a
|
|
href="javascript:void(0)"
|
|
class="btn btn-danger edit-question-dataset {% if element.default %}disabled{% endif %}"
|
|
data-id="{{ element.id }}"
|
|
data-action="delete"
|
|
title="Delete Questions"
|
|
>
|
|
<i class="bi bi-file-earmark-excel-fill button-icon"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<div class="alert alert-primary alert-db-empty">
|
|
<i class="bi bi-info-circle-fill" aria-title="Alert" title="Alert"></i>
|
|
There are no question datasets uploaded. Please use the panel below to upload a new question dataset or create a new dataset using the editor console.
|
|
</div>
|
|
{% endif %}
|
|
<div class="col text-center">
|
|
<button title="Create New" class="btn btn-md btn-primary btn-block create-new-dataset">
|
|
<i class="bi bi-cloud-plus-fill button-icon"></i>
|
|
Create New Dataset
|
|
</button>
|
|
</div>
|
|
<div class="form-container">
|
|
<form name="form-upload-questions" class="form-display" action="{{ url_for(request.endpoint, **request.view_args) }}" data-rel-success="" enctype="multipart/form-data">
|
|
<h2 class="form-heading">Upload Question Dataset</h2>
|
|
{{ form.hidden_tag() }}
|
|
<div class="form-label-group">
|
|
{{ form.name(class_="form-control", autofocus=true, placeholder="Enter Name of Dataset") }}
|
|
{{ form.name.label }}
|
|
</div>
|
|
<div class="form-upload">
|
|
{{ form.data_file() }}
|
|
</div>
|
|
<div class="form-check">
|
|
{{ form.default(class_="form-check-input") }}
|
|
{{ form.default.label }}
|
|
</div>
|
|
<div class="container form-submission-button">
|
|
<div class="row">
|
|
<div class="col text-center">
|
|
<button title="Upload Dataset" class="btn btn-md btn-success btn-block" type="submit">
|
|
<i class="bi bi-cloud-arrow-up-fill button-icon"></i>
|
|
Upload Dataset
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% if data %}
|
|
{% block custom_data_script %}
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#question-datasets-table').DataTable({
|
|
'columnDefs': [
|
|
{'sortable': false, 'targets': [0,5]},
|
|
{'searchable': false, 'targets': [1,2,3]}
|
|
],
|
|
'order': [[1, 'asc'], [2, 'desc'], [3, 'asc']],
|
|
'responsive': 'true',
|
|
'fixedHeader': 'true',
|
|
});
|
|
} );
|
|
$('#question-datasets-table').show();
|
|
$(window).trigger('resize');
|
|
</script>
|
|
{% endblock %}
|
|
{% endif %} |