Working version of test tables
This commit is contained in:
		@@ -2,25 +2,27 @@
 | 
			
		||||
{% block title %} SKA Referee Test | Manage Exams {% endblock %}
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <h1>Manage Exams</h1>
 | 
			
		||||
 | 
			
		||||
    {% if tests %}
 | 
			
		||||
        <table id="test-table" class="table table-striped" style="width:100%">
 | 
			
		||||
    {% if active_tests %}
 | 
			
		||||
        <table id="active-test-table" class="table table-striped" style="width:100%">
 | 
			
		||||
            <thead>
 | 
			
		||||
                <caption>
 | 
			
		||||
                    Active Tests
 | 
			
		||||
                </caption>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <th data-proority="1">
 | 
			
		||||
                        Date Created
 | 
			
		||||
                    </th>
 | 
			
		||||
                    <th data-priority="2">
 | 
			
		||||
                        Exam Code
 | 
			
		||||
                    <th data-priority="1">
 | 
			
		||||
                        Start Date
 | 
			
		||||
                    </th>
 | 
			
		||||
                    <th data-priority="1">
 | 
			
		||||
                        Exam Code
 | 
			
		||||
                    </th>
 | 
			
		||||
                    <th data-priority="2">
 | 
			
		||||
                        Expiry Date
 | 
			
		||||
                    </th>
 | 
			
		||||
                    <th data-proority="4">
 | 
			
		||||
                    <th data-priority="3">
 | 
			
		||||
                        Time Limit
 | 
			
		||||
                    </th>
 | 
			
		||||
                    <th data-priority="3">
 | 
			
		||||
                        Created By
 | 
			
		||||
                    <th data-priority="4">
 | 
			
		||||
                        Results
 | 
			
		||||
                    </th>
 | 
			
		||||
                    <th data-priority="1">
 | 
			
		||||
                        Actions
 | 
			
		||||
@@ -28,10 +30,10 @@
 | 
			
		||||
                </tr>
 | 
			
		||||
            </thead>
 | 
			
		||||
            <tbody>
 | 
			
		||||
                {% for test in tests %}
 | 
			
		||||
                {% for test in active_tests %}
 | 
			
		||||
                    <tr class="user-table-row">
 | 
			
		||||
                        <td>
 | 
			
		||||
                            {{ test.date.date() }}
 | 
			
		||||
                            {{ test.date.strftime('%d %b %Y') }}
 | 
			
		||||
                        </td>
 | 
			
		||||
                        <td>
 | 
			
		||||
                            {{ '—'.join([test.test_code[:4], test.test_code[4:8], test.test_code[8:]]) }}
 | 
			
		||||
@@ -79,10 +81,17 @@
 | 
			
		||||
                {% 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 active exams. Use the form below to create an exam.
 | 
			
		||||
            </div>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
        
 | 
			
		||||
    {% block custom_data_script %}
 | 
			
		||||
        <script>
 | 
			
		||||
            $(document).ready(function() {
 | 
			
		||||
                    $('#test-table').DataTable({
 | 
			
		||||
                $('#active-test-table').DataTable({
 | 
			
		||||
                    'columnDefs': [
 | 
			
		||||
                        {'sortable': false, 'targets': [1,3,5]},
 | 
			
		||||
                    {'searchable': false, 'targets': [3,5]}
 | 
			
		||||
@@ -100,20 +109,18 @@
 | 
			
		||||
            $(window).trigger('resize');
 | 
			
		||||
        </script>
 | 
			
		||||
    {% endblock %}
 | 
			
		||||
    {% else %}
 | 
			
		||||
            <div class="alert alert-primary alert-db-empty">
 | 
			
		||||
                <i class="bi bi-info-circle-fill" aria-title="Alert" title="Alert"></i>
 | 
			
		||||
                No exams have been created. Use the form below to create an exam.
 | 
			
		||||
            </div>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    <div class="form-container">
 | 
			
		||||
        <form name="form-create-test" class="form-signin">
 | 
			
		||||
            <h2 class="form-signin-heading">Create Exam</h2>
 | 
			
		||||
            {{ form.hidden_tag() }}
 | 
			
		||||
            <div class="form-date-input">
 | 
			
		||||
                {{ form.expiry(placeholder="Enter Expiry Date", class_ = "datepicker") }}
 | 
			
		||||
                {{ form.expiry.label }}
 | 
			
		||||
                {{ form.start_date(placeholder="Enter Start Date", class_ = "datepicker") }}
 | 
			
		||||
                {{ form.start_date.label }}
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="form-date-input">
 | 
			
		||||
                {{ form.expiry_date(placeholder="Enter Expiry Date", class_ = "datepicker") }}
 | 
			
		||||
                {{ form.expiry_date.label }}
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="form-select-input">
 | 
			
		||||
                {{ form.time_limit(placeholder="Select Time Limit") }}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user