121 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			121 lines
		
	
	
		
			5.2 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="2">
 | 
						|
                        Uploaded
 | 
						|
                    </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.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="#"
 | 
						|
                                class="btn btn-primary edit-question-dataset {% if element.filename == default %}disabled{% endif %}"
 | 
						|
                                data-filename="{{ element.filename }}"
 | 
						|
                                data-action="default"
 | 
						|
                                title="Make Default"
 | 
						|
                            >
 | 
						|
                                <i class="bi bi-file-earmark-text-fill button-icon"></i>
 | 
						|
                            </button>
 | 
						|
                            <a
 | 
						|
                                href="#"
 | 
						|
                                class="btn btn-danger edit-question-dataset {% if element.filename == default %}disabled{% endif %}"
 | 
						|
                                data-filename="{{ element.filename }}"
 | 
						|
                                data-action="delete"
 | 
						|
                                title="Delete Dataset"
 | 
						|
                            >
 | 
						|
                                <i class="bi bi-file-earmark-excel-fill button-icon"></i>
 | 
						|
                            </button>
 | 
						|
                        </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.
 | 
						|
        </div>
 | 
						|
    {% endif %}
 | 
						|
    <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-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="Create User" class="btn btn-md btn-success btn-block" type="submit">
 | 
						|
                            <i class="bi bi-file-earmark-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,4]},
 | 
						|
                        {'searchable': false, 'targets': [0,3,4]}
 | 
						|
                    ],
 | 
						|
                    'order': [[1, 'desc'], [2, 'asc']],
 | 
						|
                    'responsive': 'true',
 | 
						|
                    'fixedHeader': 'true',
 | 
						|
                });
 | 
						|
            } );
 | 
						|
            $('#question-datasets-table').show();
 | 
						|
            $(window).trigger('resize');
 | 
						|
        </script>
 | 
						|
    {% endblock %}
 | 
						|
{% endif %} |