joeni

Add deadline to assignments in course pages

Author
Maarten Vangeneugden
Date
Aug. 24, 2018, 12:49 a.m.
Hash
5cab554537278cad91d9d2b04cf9413883d4769d
Parent
75a3cedc225b0d39f080c4fa7dca9051b974788a
Modified file
courses/templates/courses/course.djhtml

courses/templates/courses/course.djhtml

6 additions and 2 deletions.

View changes Hide changes
1
1
{% load static %}
2
2
{% load i18n %}
3
3
{% load humanize %}
4
4
{% load joeni_org %}
5
5
6
6
{% block title %}
7
7
    {{ course.name }} | {{ block.super }}
8
8
{% endblock %}
9
9
10
10
{% block main %}
11
11
    <h1>{{ course.name }}</h1>
12
12
13
13
    <h2 id="{% trans "announcements" %}">{% trans "Announcements" %}</h2>
14
14
    <div class="flex-container">
15
15
    {% for announcement in announcements %}
16
16
        <div style="border-color: #{{ course.color }};" class="flex-item">
17
17
            <h3 id="{{ announcement.title|slugify }}">{{ announcement.title }}</h3>
18
18
            <time datetime="{{ announcement.posted|date:'c' }}">
19
19
                {% trans "Posted" %} {{ announcement.posted|naturaltime }}
20
-
            </time>
+
20
            </time>
21
21
            <p>{{ announcement.text|org }}</p>
22
22
        </div>
23
23
    {% empty %}
24
24
        {% trans "No announcements have been made for this course." %}
25
25
    {% endfor %}
26
26
    </div>
27
27
28
28
    <h2 id="{% trans "assignments" %}">{% trans "Assignments" %}</h2>
29
29
    <div class="flex-container">
30
30
    {% for assignment in assignments %}
31
31
        <div style="border-color: #{{ course.color }};" class="flex-item">
32
32
            <h3 id="{{ assignment.title|slugify }}">{{ assignment.title }}</h3>
33
33
            <time datetime="{{ assignment.posted|date:'c' }}">
34
34
                {% trans "Posted" %} {{ assignment.posted|date:"DATE_FORMAT" }} {# {{ assignment.posted|naturaltime }}#}
35
-
            </time>
+
35
            </time><br />
+
36
            <time datetime="{{ assignment.deadline|date:'c' }}">
+
37
                {% trans "Deadline:" %} {{ assignment.deadline|date:"DATE_FORMAT" }}
+
38
            </time>
36
39
            {% if assignment.information %}
+
40
            {% if assignment.information %}
37
41
                <p>{{ assignment.information|org }}</p>
38
42
            {% endif %}
39
43
            {#{% trans "Posted" %}: {{ assignment.posted|date:"DATE_FORMAT" }}#}
40
44
            {% if assignment.digital_task %}
41
45
                <h4>{% trans "Your uploads" %}</h4>
42
46
                {% for upload in uploads %}
43
47
                    {% if upload.assignment ==  assignment %}
44
48
                        {% trans "Uploaded:"%} {{ upload.upload_time|date:"SHORT_DATETIME_FORMAT" }}<br />
45
49
                        {% if upload.comment %}
46
50
                            <p>{{ upload.comment }}</p>
47
51
                        {% endif %}
48
52
                        {% if upload.upload_time > assignment.deadline %}
49
53
                            <strong>{% trans "This upload is overdue." %}</strong>
50
54
                        {% endif %}
51
55
                    {% endif %}
52
56
                {% empty %}
53
57
                    {% with now as current_time %}
54
58
                    {% if current_time > assignment.deadline %}
55
59
                        <p>
56
60
                            <strong>
57
61
                                {% blocktrans %}
58
62
                                    You have failed to provide an upload for this
59
63
                                    assignment. Any future uploads will be automatically
60
64
                                    overdue.
61
65
                                {% endblocktrans %}
62
66
                            </strong>
63
67
                        </p>
64
68
                    {% else %}
65
69
                        <p>
66
70
                            {% blocktrans %}
67
71
                                You haven't uploaded anything for this assignment
68
72
                                yet.
69
73
                            {% endblocktrans %}
70
74
                        </p>
71
75
                    {% endif %}
72
76
                    {% endwith %}
73
77
                {% endfor %}
74
78
                <h5>{% trans "Upload a task" %}</h5>
75
79
                <form action="{% url "courses-course-index" course.slug_name %}" method="post">
76
80
                    {% csrf_token %} {# todo i don't think that's necessary here #}
77
81
                    {% include "joeni/form.djhtml" with form=upload_form %}
78
82
                    <input type="submit" value="{% trans "Submit" %}" />
79
83
                </form>
80
84
            {% endif %}
81
85
        </div>
82
86
    {% endfor %}
83
87
    </div>
84
88
    <h1 id="{% trans "management" %}">{% trans "Course management" %}</h1>
85
89
    <style>
86
90
        a.btn {
87
91
        color: #{{ course.color }};
88
92
        border-color: #{{ course.color }};
89
93
        }
90
94
        a.btn:hover {
91
95
        color: white;
92
96
        background-color: #{{ course.color }};
93
97
        }
94
98
    </style>
95
99
    <a class="btn" href="{% url "courses-eci" course_slug=course.slug_name %}">
96
100
        {% trans "Edit course page" %}
97
101
    </a>
98
102
    {% comment %}
99
103
    <a class="btn" href="{% url "courses-results" course_slug=course.slug_name %}">
100
104
        {% trans "Student results" %}
101
105
    </a>
102
106
    Uncomment this section when the course results page is finished.
103
107
    {% endcomment %}
104
108
    <h2 id="{% trans "students" %}">{% trans "Students" %}</h2>
105
109
    <table>
106
110
        <tr>
107
111
            <th>{% trans "Student name" %}</th>
108
112
            <th>{% trans "Student number" %}</th>
109
113
            <th>{% trans "First result" %}</th>
110
114
            <th>{% trans "Second result" %}</th>
111
115
            <th>{% trans "Decision" %}</th>
112
116
        </tr>
113
117
            {% for student in student_list %}
114
118
                <tr>
115
119
                <td>{{ student.student }}</td>
116
120
                <td>{{ student.student.number }}</td>
117
121
                <td>{{ student.first_score|default_if_none:"-" }}</td>
118
122
                <td>{{ student.second_score|default_if_none:"-" }}</td>
119
123
                <td>{% with result=student.result %}
120
124
                    {% if result == "CRED" or result == "VRST" or result == "TLRD" or result == "ITLR"%}
121
125
                        <span style="color:green;">
122
126
                    {% elif result == "FAIL" %}
123
127
                        <span style="color:red;">
124
128
                    {% elif result == "BDRG" %}
125
129
                        <span style="background-color:red; color:white;">
126
130
                    {% elif result == "STOP" %}
127
131
                        <span style="color:black;">
128
132
                    {% endif %}
129
133
                    {{ student.get_result_display }}</span>
130
134
                {% endwith %}</td>
131
135
        </tr>
132
136
        {% endfor %}
133
137
        </table>
134
138
{% endblock main %}
135
139