Skip to content
Snippets Groups Projects
Verified Commit 4e460d55 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'master' into feature/performance-optimizations

parents c32c3d04 8e855851
No related branches found
No related tags found
1 merge request!90Performance optimizations
Pipeline #4080 failed
......@@ -7,3 +7,31 @@ table a.tr-link {
width: inherit;
height: inherit;
}
.collapsible-icon-right {
align-self: end;
flex-grow: 100;
text-align: right!important;
}
@media only screen and (min-width: 1201px) {
.hide-on-extra-large-only {
display: none;
}
}
@media only screen and (max-width: 1200px) {
.show-on-extra-large {
display: none;
}
}
@media only screen and (max-width: 600px) {
.collection .collection-item.avatar {
padding-left: 20px;
}
.collection .collection-item.avatar:not(.circle-clipper) > .circle {
position: relative;
margin-bottom: 10px;
}
}
......@@ -10,6 +10,11 @@
text-decoration: line-through;
}
.alsijil-tardiness-text{
vertical-align: super;
}
@media only screen and (max-width : 992px) {
table.responsive-table.alsijil-table th,
table.responsive-table.alsijil-table td {
......
{# -*- engine:django -*- #}
{% extends "core/base.html" %}
{% load week_helpers material_form_internal material_form i18n static rules %}
{% load week_helpers material_form_internal material_form i18n static rules time_helpers %}
{% block browser_title %}{% blocktrans %}Lesson{% endblocktrans %}{% endblock %}
......@@ -10,6 +10,12 @@
{% endblock %}
{% block page_title %}
{% with lesson_period.get_lesson_documentation as lesson_doc %}
<a href="{% url "week_view_by_week" lesson_doc.year lesson_doc.week "group" lesson_period.lesson.groups.all.0.pk %}"
class="btn-flat primary-color-text waves-light waves-effect">
<i class="material-icons left">chevron_left</i> {% trans "Back" %}
</a>
{% endwith %}
{{ day }}, {% blocktrans with period=lesson_period.period.period %}{{ period }}. period{% endblocktrans %} –
{% for group in lesson_period.get_groups.all %}
......@@ -66,6 +72,12 @@
<a href="#personal-notes">{% trans "Personal notes" %}</a>
</li>
{% endif %}
{% has_perm "alsijil.view_lessondocumentation" user lesson_period.prev as can_view_prev_lesson_documentation %}
{% if lesson_period.prev.get_lesson_documentation and can_view_prev_lesson_documentation %}
<li class="tab">
<a href="#previous-lesson">{% trans "Previous lesson" %}</a>
</li>
{% endif %}
<li class="tab">
<a href="#version-history">{% trans "Change history" %}</a>
</li>
......@@ -73,11 +85,52 @@
</div>
<div class="col s12" id="lesson-documentation">
{% with prev_doc=prev_lesson.get_lesson_documentation absences=prev_lesson.get_absences tardinesses=prev_lesson.get_tardinesses extra_marks=prev_lesson.get_extra_marks %}
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Lesson documentation{% endblocktrans %}
</span>
{% if can_edit_lesson_documentation %}
{% form form=lesson_documentation_form %}{% endform %}
{% elif can_view_lesson_documentation %}
<table>
<tr>
<th>
{% trans "Lesson topic" %}
</th>
<td>
{{ lesson_documentation.topic }}
</td>
</tr>
<tr>
<th>
{% trans "Homework" %}
</th>
<td>
{{ lesson_documentation.homework }}
</td>
</tr>
<tr>
<th>
{% trans "Group note" %}
</th>
<td>
{{ lesson_documentation.group_note }}
</td>
</tr>
</table>
{% endif %}
</div>
</div>
</div>
{% with prev_lesson=lesson_period.prev prev_doc=prev_lesson.get_lesson_documentation %}
{% with absences=prev_lesson.get_absences tardinesses=prev_lesson.get_tardinesses extra_marks=prev_lesson.get_extra_marks %}
{% has_perm "alsijil.view_lessondocumentation" user prev_lesson as can_view_prev_lesson_documentation %}
{% if prev_doc and can_view_prev_lesson_documentation %}
{% weekday_to_date prev_lesson.week prev_lesson.period.weekday as prev_date %}
<div class="col s12" id="previous-lesson">
<div class="card">
<div class="card-content">
<span class="card-title">
......@@ -140,46 +193,7 @@
</div>
{% endif %}
{% endwith %}
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Lesson documentation{% endblocktrans %}
</span>
{% if can_edit_lesson_documentation %}
{% form form=lesson_documentation_form %}{% endform %}
{% elif can_view_lesson_documentation %}
<table>
<tr>
<th>
{% trans "Lesson topic" %}
</th>
<td>
{{ lesson_documentation.topic }}
</td>
</tr>
<tr>
<th>
{% trans "Homework" %}
</th>
<td>
{{ lesson_documentation.homework }}
</td>
</tr>
<tr>
<th>
{% trans "Group note" %}
</th>
<td>
{{ lesson_documentation.group_note }}
</td>
</tr>
</table>
{% endif %}
</div>
</div>
</div>
{% endwith %}
{% if not lesson_period.get_substitution.cancelled or not request.site.preferences.alsijil__block_personal_notes_for_cancelled %}
<div class="col s12" id="personal-notes">
......@@ -263,16 +277,23 @@
{% else %}
<tr>
<td>{{ form.person_name.value }}</td>
<td>{{ form.absent.value }}</td>
<td>{{ form.late.value }}</td>
<td>{{ form.excused.value }}</td>
<td>{{ form.excuse_type.value }}</td>
<td><i class="material-icons center">{{ form.absent.value|yesno:"check,clear" }}</i></td>
<td>
<i class="material-icons center">{{ form.late.value|yesno:"check,clear" }}</i>
<span class="alsijil-tardiness-text">
{% if form.late.value %}{{ form.late.value|to_time|time:"i\m" }}{% endif %}
</span>
</td>
<td><i class="material-icons center">{{ form.excused.value|yesno:"check,clear" }}</i></td>
<td>{% firstof form.excuse_type.value "–" %}</td>
<td>
{% for extra_mark in form.extra_marks.value %}
{{ extra_mark }}{% if not forloop.last %},{% endif %}
{% empty %}
{% endfor %}
</td>
<td>{{ form.remarks.value }}</td>
<td>{% firstof form.remarks.value "–" %}</td>
</tr>
{% endif %}
{% endfor %}
......@@ -295,10 +316,10 @@
</div>
</div>
{% endif %}
</div>
</div>
{% if can_edit_lesson_documentation or can_edit_lesson_personalnote %}
<p>{% include "core/partials/save_button.html" %}</p>
{% endif %}
{% if can_edit_lesson_documentation or can_edit_lesson_personalnote %}
<p>{% include "core/partials/save_button.html" %}</p>
{% endif %}
</form>
{% endblock %}
......@@ -9,6 +9,13 @@
{% block page_title %}
{% has_perm "alsijil.view_my_students" user as has_students %}
{% if has_students %}
<a href="{% url "my_students" %}"
class="btn-flat primary-color-text waves-light waves-effect">
<i class="material-icons left">chevron_left</i> {% trans "Back" %}
</a>
{% endif %}
{% blocktrans with person=person %}
Class register overview for {{ person }}
{% endblocktrans %}
......@@ -59,8 +66,9 @@
{% endif %}
</li>
{% empty %}
<li class="collection-item flow-text">
{% trans "There are unexcused lessons." %}
<li class="collection-item avatar valign-wrapper">
<i class="material-icons left circle green white-text">check</i>
<span class="title">{% trans "There are no unexcused lessons." %}</span>
</li>
{% endfor %}
</ul>
......
{# -*- engine:django -*- #}
{% extends "core/base.html" %}
{% load material_form i18n week_helpers static data_helpers rules %}
{% load material_form i18n week_helpers static data_helpers rules time_helpers %}
{% block browser_title %}{% blocktrans %}Week view{% endblocktrans %}{% endblock %}
......@@ -42,10 +42,16 @@
{% if lesson_periods %}
<div class="row">
<div class="col s12 m7">
<div class="col s12">
<ul class="tabs">
<li class="tab col s6"><a class="active" href="#week-overview">{% trans "Lesson documentations" %}</a></li>
<li class="tab col s6"><a class="active" href="#personal-notes">{% trans "Personal notes" %}</a></li>
</ul>
</div>
<div class="col s12" id="week-overview">
{% regroup lesson_periods by period.get_weekday_display as periods_by_day %}
{% for weekday, periods in periods_by_day %}
<div class="card">
<div class="card show-on-extra-large">
<div class="card-content">
{% weekday_to_date week periods.0.period.weekday as current_date %}
<span class="card-title">
......@@ -62,6 +68,8 @@
<th>{% blocktrans %}Subject{% endblocktrans %}</th>
<th>{% blocktrans %}Teachers{% endblocktrans %}</th>
<th>{% blocktrans %}Lesson topic{% endblocktrans %}</th>
<th>{% blocktrans %}Homework{% endblocktrans %}</th>
<th>{% blocktrans %}Group note{% endblocktrans %}</th>
</tr>
</thead>
<tbody>
......@@ -96,9 +104,19 @@
</td>
<td>
<a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{{ period.get_lesson_documentation.topic }}
{% firstof period.get_lesson_documentation.topic "–" %}
</a>
</td>
<td>
<a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{% firstof period.get_lesson_documentation.homework "–" %}
</a>
</td>
<td>
<a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{% firstof period.get_lesson_documentation.group_note "–" %}
</a>
</td>
</tr>
{% endif %}
{% endfor %}
......@@ -106,9 +124,98 @@
</table>
</div>
</div>
<ul class="collapsible hide-on-extra-large-only">
<li class="">
{% weekday_to_date week periods.0.period.weekday as current_date %}
<div class="collapsible-header flow-text">
{{ weekday }}, {{ current_date }} <i class="material-icons collapsible-icon-right">expand_more</i>
</div>
<div class="collapsible-body">
<div class="collection">
{% for period in periods %}
{% has_perm "alsijil.view_lessondocumentation" user period as can_view_lesson_documentation %}
{% if can_view_lesson_documentation %}
<a class="collection-item avatar"
href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{% include "alsijil/partials/lesson_status_icon.html" with period=period css_class="circle" color_suffix=" " %}
<table class="hide-on-med-and-down">
<tr>
<th>{% trans "Subject" %}</th>
<td>{{ period.period.period }}. {{ period.get_subject.name }}</td>
</tr>
{% if not group %}
<tr>
<th>{% trans "Group" %}</th>
<td>{{ period.lesson.group_names }}</td>
</tr>
{% endif %}
<tr>
<th>{% trans "Teachers" %}</th>
<td>{{ period.lesson.teacher_names }}</td>
</tr>
<tr>
<th>{% trans "Lesson topic" %}</th>
<td>{% firstof period.get_lesson_documentation.topic "–" %}</td>
</tr>
{% with period.get_lesson_documentation as lesson_documentation %}
{% if lesson_documentation.homework %}
<tr>
<th>{% trans "Homework" %}</th>
<td>{% firstof period.get_lesson_documentation.homework "–" %}</td>
</tr>
{% endif %}
{% if lesson_documentation.group_note %}
<tr>
<th>{% trans "Group note" %}</th>
<td>{% firstof period.get_lesson_documentation.group_note "–" %}</td>
</tr>
{% endif %}
{% endwith %}
</table>
<div class="hide-on-large-only">
<ul class="collection">
<li class="collection-item">
{{ period.period.period }}. {{ period.get_subject.name }}
</li>
{% if not group %}
<li class="collection-item">
{{ period.lesson.group_names }}
</li>
{% endif %}
<li class="collection-item">
{{ period.lesson.teacher_names }}
</li>
<li class="collection-item">
{{ period.get_lesson_documentation.topic }}
</li>
{% with period.get_lesson_documentation as lesson_documentation %}
{% if lesson_documentation.homework %}
<li class="collection-item">
<strong>{% trans "Homework" %}</strong>
{% firstof period.get_lesson_documentation.homework "–" %}
</li>
{% endif %}
{% if lesson_documentation.group_note %}
<li class="collection-item">
<strong>{% trans "Group note" %}</strong>
{% firstof period.get_lesson_documentation.group_note "–" %}
</li>
{% endif %}
{% endwith %}
</ul>
</div>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</li>
</ul>
{% endfor %}
</div>
<div class="col s12 m5">
<div class="col s12" id="personal-notes">
<div class="card">
<div class="card-content">
<span class="card-title">
......@@ -128,7 +235,7 @@
({{ person.person.unexcused_count }} {% trans "unexcused" %})
</p>
<p class="card-text">
{% trans "Summed up tardiness" %}: {{ person.person.tardiness_sum }}'
{% trans "Summed up tardiness" %}: {% firstof person.person.tardiness_sum|to_time|time:"H\h i\m" "–" %}
</p>
{% for extra_mark in extra_marks %}
<p class="card-text">
......
......@@ -3,18 +3,18 @@
{% now_datetime as now_dt %}
{% if period.has_documentation %}
<i class="material-icons green-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Data complete" %}" title="{% trans "Data complete" %}">check_circle</i>
<i class="material-icons green{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Data complete" %}" title="{% trans "Data complete" %}">check_circle</i>
{% else %}
{% period_to_time_start week period.period as time_start %}
{% period_to_time_end week period.period as time_end %}
{% if period.get_substitution.cancelled %}
<i class="material-icons red-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Lesson cancelled" %}" title="{% trans "Lesson cancelled" %}">cancel</i>
<i class="material-icons red{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Lesson cancelled" %}" title="{% trans "Lesson cancelled" %}">cancel</i>
{% elif now_dt > time_end %}
<i class="material-icons red-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Missing data" %}" title="{% trans "Missing data" %}">history</i>
<i class="material-icons red{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Missing data" %}" title="{% trans "Missing data" %}">history</i>
{% elif now_dt > time_start and now_dt < time_end %}
<i class="material-icons orange-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Pending" %}" title="{% trans "Pending" %}">more_horiz</i>
<i class="material-icons orange{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Pending" %}" title="{% trans "Pending" %}">more_horiz</i>
{% elif period.get_substitution %}
<i class="material-icons orange-text tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Substitution" %}" title="{% trans "Substitution" %}">update</i>
<i class="material-icons orange{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Substitution" %}" title="{% trans "Substitution" %}">update</i>
{% endif %}
{% endif %}
from django import template
import datetime
register = template.Library()
@register.filter("to_time")
def get_time_from_minutes(minutes: int) -> datetime.timedelta:
"""Get a time object from a number of minutes."""
delta = datetime.timedelta(minutes=(minutes or 0))
time_obj = (datetime.datetime.min + delta).time()
return time_obj
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment