Skip to content
Snippets Groups Projects
Commit 8e855851 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch '94-check-responsive-design' into 'master'

Resolve "Check (responsive) design"

Closes #94, #100 und #101

See merge request !88
parents 50db5254 c733086c
No related branches found
No related tags found
1 merge request!88Resolve "Check (responsive) design"
Pipeline #4075 failed
...@@ -7,3 +7,31 @@ table a.tr-link { ...@@ -7,3 +7,31 @@ table a.tr-link {
width: inherit; width: inherit;
height: 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 @@ ...@@ -10,6 +10,11 @@
text-decoration: line-through; text-decoration: line-through;
} }
.alsijil-tardiness-text{
vertical-align: super;
}
@media only screen and (max-width : 992px) { @media only screen and (max-width : 992px) {
table.responsive-table.alsijil-table th, table.responsive-table.alsijil-table th,
table.responsive-table.alsijil-table td { table.responsive-table.alsijil-table td {
......
{# -*- engine:django -*- #} {# -*- engine:django -*- #}
{% extends "core/base.html" %} {% 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 %} {% block browser_title %}{% blocktrans %}Lesson{% endblocktrans %}{% endblock %}
...@@ -10,6 +10,12 @@ ...@@ -10,6 +10,12 @@
{% endblock %} {% endblock %}
{% block page_title %} {% 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 %} – {{ day }}, {% blocktrans with period=lesson_period.period.period %}{{ period }}. period{% endblocktrans %} –
{% for group in lesson_period.get_groups.all %} {% for group in lesson_period.get_groups.all %}
...@@ -70,6 +76,12 @@ ...@@ -70,6 +76,12 @@
<a href="#personal-notes">{% trans "Personal notes" %}</a> <a href="#personal-notes">{% trans "Personal notes" %}</a>
</li> </li>
{% endif %} {% 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"> <li class="tab">
<a href="#version-history">{% trans "Change history" %}</a> <a href="#version-history">{% trans "Change history" %}</a>
</li> </li>
...@@ -77,12 +89,52 @@ ...@@ -77,12 +89,52 @@
</div> </div>
<div class="col s12" id="lesson-documentation"> <div class="col s12" id="lesson-documentation">
{% with prev_lesson=lesson_period.prev prev_doc=prev_lesson.get_lesson_documentation %} <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 prev_doc=prev_lesson.get_lesson_documentation absences=prev_lesson.get_absences tardinesses=prev_lesson.get_tardinesses extra_marks=prev_lesson.get_extra_marks %} {% 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 %}
{% has_perm "alsijil.view_lessondocumentation" user prev_lesson as can_view_prev_lesson_documentation %} {% has_perm "alsijil.view_lessondocumentation" user prev_lesson as can_view_prev_lesson_documentation %}
{% if prev_doc and 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 %} {% 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">
<div class="card-content"> <div class="card-content">
<span class="card-title"> <span class="card-title">
...@@ -143,50 +195,11 @@ ...@@ -143,50 +195,11 @@
</table> </table>
</div> </div>
</div> </div>
</div>
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% endwith %} {% 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>
{% if not lesson_period.get_substitution.cancelled or not request.site.preferences.alsijil__block_personal_notes_for_cancelled %} {% 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"> <div class="col s12" id="personal-notes">
<div class="card"> <div class="card">
...@@ -269,16 +282,23 @@ ...@@ -269,16 +282,23 @@
{% else %} {% else %}
<tr> <tr>
<td>{{ form.person_name.value }}</td> <td>{{ form.person_name.value }}</td>
<td>{{ form.absent.value }}</td> <td><i class="material-icons center">{{ form.absent.value|yesno:"check,clear" }}</i></td>
<td>{{ form.late.value }}</td> <td>
<td>{{ form.excused.value }}</td> <i class="material-icons center">{{ form.late.value|yesno:"check,clear" }}</i>
<td>{{ form.excuse_type.value }}</td> <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> <td>
{% for extra_mark in form.extra_marks.value %} {% for extra_mark in form.extra_marks.value %}
{{ extra_mark }}{% if not forloop.last %},{% endif %} {{ extra_mark }}{% if not forloop.last %},{% endif %}
{% empty %}
{% endfor %} {% endfor %}
</td> </td>
<td>{{ form.remarks.value }}</td> <td>{% firstof form.remarks.value "–" %}</td>
</tr> </tr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
......
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
{% block page_title %} {% 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 %} {% blocktrans with person=person %}
Class register overview for {{ person }} Class register overview for {{ person }}
{% endblocktrans %} {% endblocktrans %}
...@@ -59,8 +66,9 @@ ...@@ -59,8 +66,9 @@
{% endif %} {% endif %}
</li> </li>
{% empty %} {% empty %}
<li class="collection-item flow-text"> <li class="collection-item avatar valign-wrapper">
{% trans "There are unexcused lessons." %} <i class="material-icons left circle green white-text">check</i>
<span class="title">{% trans "There are no unexcused lessons." %}</span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
......
{# -*- engine:django -*- #} {# -*- engine:django -*- #}
{% extends "core/base.html" %} {% 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 %} {% block browser_title %}{% blocktrans %}Week view{% endblocktrans %}{% endblock %}
...@@ -42,10 +42,16 @@ ...@@ -42,10 +42,16 @@
{% if lesson_periods %} {% if lesson_periods %}
<div class="row"> <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 %} {% regroup lesson_periods by period.get_weekday_display as periods_by_day %}
{% for weekday, periods in periods_by_day %} {% for weekday, periods in periods_by_day %}
<div class="card"> <div class="card show-on-extra-large">
<div class="card-content"> <div class="card-content">
{% weekday_to_date week periods.0.period.weekday as current_date %} {% weekday_to_date week periods.0.period.weekday as current_date %}
<span class="card-title"> <span class="card-title">
...@@ -62,6 +68,8 @@ ...@@ -62,6 +68,8 @@
<th>{% blocktrans %}Subject{% endblocktrans %}</th> <th>{% blocktrans %}Subject{% endblocktrans %}</th>
<th>{% blocktrans %}Teachers{% endblocktrans %}</th> <th>{% blocktrans %}Teachers{% endblocktrans %}</th>
<th>{% blocktrans %}Lesson topic{% endblocktrans %}</th> <th>{% blocktrans %}Lesson topic{% endblocktrans %}</th>
<th>{% blocktrans %}Homework{% endblocktrans %}</th>
<th>{% blocktrans %}Group note{% endblocktrans %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -96,9 +104,19 @@ ...@@ -96,9 +104,19 @@
</td> </td>
<td> <td>
<a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}"> <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> </a>
</td> </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> </tr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
...@@ -106,9 +124,98 @@ ...@@ -106,9 +124,98 @@
</table> </table>
</div> </div>
</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 %} {% endfor %}
</div> </div>
<div class="col s12 m5"> <div class="col s12" id="personal-notes">
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<span class="card-title"> <span class="card-title">
...@@ -128,7 +235,7 @@ ...@@ -128,7 +235,7 @@
({{ person.person.unexcused_count }} {% trans "unexcused" %}) ({{ person.person.unexcused_count }} {% trans "unexcused" %})
</p> </p>
<p class="card-text"> <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> </p>
{% for extra_mark in extra_marks %} {% for extra_mark in extra_marks %}
<p class="card-text"> <p class="card-text">
......
...@@ -3,18 +3,18 @@ ...@@ -3,18 +3,18 @@
{% now_datetime as now_dt %} {% now_datetime as now_dt %}
{% if period.has_documentation %} {% 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 %} {% else %}
{% period_to_time_start week period.period as time_start %} {% period_to_time_start week period.period as time_start %}
{% period_to_time_end week period.period as time_end %} {% period_to_time_end week period.period as time_end %}
{% if period.get_substitution.cancelled %} {% 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 %} {% 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 %} {% 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 %} {% 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 %}
{% 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