Skip to content
Snippets Groups Projects
Commit 73aef4f1 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '189-improve-design-of-detail-view-for-one-register-object' into 'master'

Resolve "Improve design of detail view for one register object"

Closes #189

See merge request !235
parents 4d1d63a0 64acfa79
No related branches found
No related tags found
1 merge request!235Resolve "Improve design of detail view for one register object"
Pipeline #43586 passed
Showing
with 757 additions and 578 deletions
...@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_. ...@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_.
Unreleased Unreleased
---------- ----------
Changed
~~~~~~~
* Optimize view for one register object ("lesson view") for mobile and tablet devices.
Fixed Fixed
~~~~~ ~~~~~
......
...@@ -23,6 +23,55 @@ ...@@ -23,6 +23,55 @@
height: 109px;} height: 109px;}
} }
.alsijil-top-button { .alsijil-time-head, .alsijil-object-head {
margin-top: -20px; display: block;
} }
.alsijil-time-head {
font-size: 2rem;
line-height: 1.1;
}
.alsijil-object-head {
font-size: 3rem;
}
@media only screen and (max-width: 600px) {
.alsijil-time-head {
font-size: 1.5rem;
}
.alsijil-object-head {
font-size: 2.2rem;
line-height: 1.4;
}
}
.alsijil-nav {
line-height: 36px;
}
.alsijil-header-nav-button {
height: 66px;
padding: 0;
}
.alsijil-header-nav-button.left {
margin-right: 5px;
}
.alsijil-header-nav-button.right {
margin-left: 5px;
}
.alsijil-header-nav-button i.material-icons {
line-height: 60px;
height: 60px;
font-size: 40px;
}
.alsijil-nav-header {
width: calc(100% + 40px);
padding: 10px 20px;
margin: -10px -20px 0;
}
\ No newline at end of file
...@@ -192,15 +192,15 @@ class RegisterObjectTable(tables.Table): ...@@ -192,15 +192,15 @@ class RegisterObjectTable(tables.Table):
group_note = tables.Column(linkify=_get_link) group_note = tables.Column(linkify=_get_link)
def render_status(self, value, record): def render_status(self, value, record):
return render_to_string( context = {
"alsijil/partials/lesson_status_icon.html", "has_documentation": record.get("has_documentation", False),
dict( "register_object": value,
week=record.get("week"), }
has_documentation=record.get("has_documentation", False), if record.get("week"):
substitution=record.get("substitution"), context["week"] = record["week"]
register_object=value, if record.get("substitution"):
), context["substitution"] = record["substitution"]
) return render_to_string("alsijil/partials/lesson_status.html", context)
class RegisterObjectSelectTable(RegisterObjectTable): class RegisterObjectSelectTable(RegisterObjectTable):
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
{% if can_view_lesson_documentation %} {% if can_view_lesson_documentation %}
<tr> <tr>
<td class="center-align"> <td class="center-align">
{% include "alsijil/partials/lesson_status_icon.html" with register_object=register_object %} {% include "alsijil/partials/lesson_status.html" with register_object=register_object %}
</td> </td>
<td class="tr-link"> <td class="tr-link">
<a class="tr-link" <a class="tr-link"
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
{% if can_view_lesson_documentation %} {% if can_view_lesson_documentation %}
<a class="collection-item avatar" <a class="collection-item avatar"
href="{{ register_object.alsijil_url }}?back={{ back_url }}"> href="{{ register_object.alsijil_url }}?back={{ back_url }}">
{% include "alsijil/partials/lesson_status_icon.html" with register_object=register_object css_class="materialize-circle" color_suffix=" " %} {% include "alsijil/partials/lesson_status.html" with register_object=register_object css_class="materialize-circle" color_suffix=" " %}
<table class="hide-on-med-and-down"> <table class="hide-on-med-and-down">
<tr> <tr>
<th>{% trans "Subject" %}</th> <th>{% trans "Subject" %}</th>
......
{% load i18n %}
<h1>
<span class="right hide-on-small-only">
{% include "alsijil/partials/lesson_status.html" with register_object=register_object css_class="medium" %}
</span>
<a class="btn-flat waves-effect waves-light primary-color-text left alsijil-header-nav-button hide-on-med-and-up {% if not prev_lesson %}disabled{% endif %}"
{% if prev_lesson %}
href="{% url "lesson_period" prev_lesson.week.year prev_lesson.week.week prev_lesson.id %}"
{% endif %}
>
<i class="material-icons center">navigate_before</i>
</a>
<a class="btn-flat waves-effect waves-light primary-color-text right alsijil-header-nav-button hide-on-med-and-up {% if not next_lesson %}disabled{% endif %}"
{% if next_lesson %}
href="{% url "lesson_period" next_lesson.week.year next_lesson.week.week next_lesson.id %}"
{% endif %}
>
<i class="material-icons center">navigate_next</i>
</a>
<span class="alsijil-time-head">
{% if register_object.label_ == "event" %}
{% if register_object.date_start == register_object.date_end %}
{% if register_object.period_from.period == register_object.period_to.period %}
{{ register_object.date_start|date:"SHORT_DATE_FORMAT" }},
{% blocktrans with period=register_object.period_from.period %}{{ period }}. period{% endblocktrans %}
{% else %}
{{ register_object.date_start|date:"SHORT_DATE_FORMAT" }},
{% blocktrans with period_from=register_object.period_from.period period_to=register_object.period_to.period %}
{{ period_from }}.–{{ period_to }}. period
{% endblocktrans %}
{% endif %}
{% else %}
{{ register_object.date_start|date:"SHORT_DATE_FORMAT" }},
{{ register_object.period_from.period }}.–{{ register_object.date_end|date:"SHORT_DATE_FORMAT" }},
{{ register_object.period_to.period }}.
{% endif %}
{% else %}
{{ day|date:"SHORT_DATE_FORMAT" }},
{% blocktrans with period=register_object.period.period %}{{ period }}. period{% endblocktrans %}
{% endif %}
</span>
<span class="alsijil-object-head">
{{ register_object.group_names }},
{% if register_object.label_ == "event" %}
{% trans "Event" %} ({{ register_object.title }}),
{% else %}
{{ register_object.get_subject.short_name }},
{% endif %}
{{ register_object.teacher_short_names }}
</span>
</h1>
<div class="hide-on-med-and-up margin-bottom">
{% include "alsijil/partials/lesson_status.html" with register_object=register_object chip=1 css_class="hundred-percent center" %}
</div>
{% load i18n %}
<div class="row no-margin hide-on-small-only">
<div class="col s12 no-padding">
{% if not blocked_because_holidays and with_save %}
{% if can_edit_lesson_documentation or can_edit_register_object_personalnote %}
<button type="submit" class="btn waves-effect waves-light green margin-bottom">
<i class="material-icons left">save</i> {% trans "Save" %}
</button>
{% endif %}
{% endif %}
<a class="btn waves-effect waves-light primary margin-bottom {% if not prev_lesson %}disabled{% endif %}"
{% if prev_lesson %}
href="{% url "lesson_period" prev_lesson.week.year prev_lesson.week.week prev_lesson.id %}"
{% endif %}
>
<i class="material-icons left">arrow_back</i>
{% blocktrans with subject=register_object.get_subject.short_name %}
Previous {{ subject }} lesson
{% endblocktrans %}
</a>
<a class="btn right waves-effect waves-light primary margin-bottom {% if not next_lesson %}disabled{% endif %}"
{% if next_lesson %}
href="{% url "lesson_period" next_lesson.week.year next_lesson.week.week next_lesson.id %}"
{% endif %}
>
<i class="material-icons right">arrow_forward</i>
{% blocktrans with subject=register_object.get_subject.short_name %}
Next {{ subject }} lesson
{% endblocktrans %}
</a>
</div>
</div>
{% load i18n material_form_internal material_form %}
{% include "alsijil/partials/lesson/heading.html" %}
{% include "alsijil/partials/lesson/prev_next.html" with with_save=0 %}
<div class="hide-on-med-and-up margin-bottom">
{% if not blocked_because_holidays %}
{% if can_edit_lesson_documentation or can_edit_register_object_personalnote %}
{% include "core/partials/save_button.html" %}
{% endif %}
{% endif %}
</div>
<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 class="card-action-light hide-on-small-only">
{% if not blocked_because_holidays %}
{% if can_edit_lesson_documentation or can_edit_register_object_personalnote %}
{% include "core/partials/save_button.html" %}
{% endif %}
{% endif %}
</div>
</div>
<div class="hide-on-med-and-up">
{% if not blocked_because_holidays %}
{% if can_edit_lesson_documentation or can_edit_register_object_personalnote %}
{% include "core/partials/save_button.html" %}
{% endif %}
{% endif %}
</div>
\ No newline at end of file
{% load i18n %}
{% include "alsijil/partials/lesson/heading.html" %}
{% if group_roles %}
{% include "alsijil/group_role/partials/assigned_roles.html" with roles=group_roles group=register_object.get_groups.first back_url=back_url %}
{% endif %}
{% if can_view_lesson_documentation %}
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Change history{% endblocktrans %}
</span>
{% include 'core/partials/crud_events.html' with obj=lesson_documentation %}
</div>
</div>
{% endif %}
\ No newline at end of file
{% load i18n material_form_internal material_form time_helpers %}
{% include "alsijil/partials/lesson/heading.html" %}
{% include "alsijil/partials/lesson/prev_next.html" with with_save=1 %}
{% if not blocked_because_holidays %}
{% if can_edit_lesson_documentation or can_edit_register_object_personalnote %}
<button type="submit"
class="btn waves-effect waves-light green margin-bottom hundred-percent hide-on-med-and-up">
<i class="material-icons left">save</i> {% trans "Save" %}
</button>
{% endif %}
{% endif %}
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Personal notes{% endblocktrans %}
</span>
{% if can_edit_register_object_personalnote %}
{% form form=personal_note_formset.management_form %}{% endform %}
{% endif %}
<table class="striped responsive-table alsijil-table">
<thead>
<tr>
<th>{% blocktrans %}Person{% endblocktrans %}</th>
<th>{% blocktrans %}Absent{% endblocktrans %}</th>
<th>{% blocktrans %}Tardiness{% endblocktrans %}</th>
<th>{% blocktrans %}Excused{% endblocktrans %}</th>
<th>{% blocktrans %}Excuse type{% endblocktrans %}</th>
<th>{% blocktrans %}Extra marks{% endblocktrans %}</th>
<th>{% blocktrans %}Remarks{% endblocktrans %}</th>
</tr>
</thead>
<tbody>
{% for form in personal_note_formset %}
{% if can_edit_register_object_personalnote %}
<tr>
{{ form.id }}
<td>{{ form.person_name }}{{ form.person_name.value }}
<p>
{% for assignment in form.instance.person.group_roles.all %}
{% include "alsijil/group_role/chip.html" with role=assignment.role %}
{% endfor %}
</p>
</td>
<td class="center-align">
<label>
{{ form.absent }}
<span></span>
</label>
</td>
<td>
<div class="input-field">
{{ form.late }}
<label for="{{ form.absent.id_for_label }}">
{% trans "Tardiness (in m)" %}
</label>
</div>
</td>
<td class="center-align">
<label>
{{ form.excused }}
<span></span>
</label>
</td>
<td>
<div class="input-field">
{{ form.excuse_type }}
<label for="{{ form.excuse_type.id_for_label }}">
{% trans "Excuse type" %}
</label>
</div>
</td>
<td>
{% for group, items in form.extra_marks|select_options %}
{% for choice, value, selected in items %}
<label class="{% if selected %} active{% endif %} alsijil-check-box">
<input type="checkbox"
{% if value == None or value == '' %}disabled{% else %}value="{{ value }}"{% endif %}
{% if selected %} checked="checked"{% endif %}
name="{{ form.extra_marks.html_name }}">
<span>{{ choice }}</span>
</label>
{% endfor %}
{% endfor %}
</td>
<td>
<div class="input-field">
{{ form.remarks }}
<label for="{{ form.remarks.id_for_label }}">
{% trans "Remarks" %}
</label>
</div>
</td>
</tr>
{% else %}
<tr>
<td>{{ form.person_name.value }}
<p>
{% for assignment in form.instance.person.group_roles.all %}
{% include "alsijil/group_role/chip.html" with role=assignment.role %}
{% endfor %}
</p>
</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>{% firstof form.remarks.value "–" %}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if not blocked_because_holidays %}
{% if can_edit_lesson_documentation or can_edit_register_object_personalnote %}
<button type="submit"
class="btn waves-effect waves-light green margin-bottom hundred-percent hide-on-med-and-up">
<i class="material-icons left">save</i> {% trans "Save" %}
</button>
{% endif %}
{% endif %}
\ No newline at end of file
{% load i18n rules %}
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Overview: Previous lesson{% endblocktrans %} ({{ prev_doc.date_formatted }},
{% blocktrans with period=prev_lesson.period.period %}{{ period }}. period{% endblocktrans %})
</span>
<table>
{% if prev_doc.topic %}
<tr>
<th class="collection-item">{% trans "Lesson topic of previous lesson:" %}</th>
<td>{{ prev_doc.topic }}</td>
</tr>
{% endif %}
{% if prev_doc.homework %}
<tr>
<th class="collection-item">{% trans "Homework for this lesson:" %}</th>
<td>{{ prev_doc.homework }}</td>
</tr>
{% endif %}
{% if prev_doc.group_note %}
<tr>
<th class="collection-item">{% trans "Group notes for previous lesson:" %}</th>
<td>{{ prev_doc.group_note }}</td>
</tr>
{% endif %}
{% if absences %}
<tr>
<th>{% trans "Absent persons:" %}</th>
<td>{% include "alsijil/partials/absences.html" with notes=absences %}</td>
</tr>
{% endif %}
{% if tardinesses %}
<tr>
<th>{% trans "Late persons:" %}</th>
<td>{% include "alsijil/partials/tardinesses.html" with notes=tardinesses %}</td>
</tr>
{% endif %}
{% for extra_mark, notes in extra_marks.items %}
<tr>
<th>{{ extra_mark.name }}</th>
<td>
{% for note in notes %}
{% has_perm "alsijil.view_personalnote_rule" user note as can_view_personalnote %}
{% if can_view_personalnote %}
<span>{{ note.person }}{% if not forloop.last %},{% endif %}</span>
{% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
\ No newline at end of file
{% load i18n week_helpers %}
{% now_datetime as now_dt %}
{% if has_documentation or register_object.has_documentation %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Data complete") icon="check_circle" color="green" %}
{% elif not register_object.period %}
{% if week %}
{% period_to_time_start week register_object.raw_period_from_on_day as time_start %}
{% period_to_time_end week register_object.raw_period_to_on_day as time_end %}
{% else %}
{% period_to_time_start register_object.date_start register_object.period_from as time_start %}
{% period_to_time_end register_object.date_end register_object.period_to as time_end %}
{% endif %}
{% if now_dt > time_end %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Missing data") icon="warning" color="red" %}
{% elif now_dt > time_start and now_dt < time_end %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Pending") icon="more_horiz" color="orange" %}
{% else %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Event") icon="event" color="purple" %}
{% endif %}
{% else %}
{% period_to_time_start week register_object.period as time_start %}
{% period_to_time_end week register_object.period as time_end %}
{% if substitution.cancelled or register_object.get_substitution.cancelled %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Lesson cancelled") icon="cancel" color="red" %}
{% elif now_dt > time_end %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Missing data") icon="warning" color="red" %}
{% elif now_dt > time_start and now_dt < time_end %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Pending") icon="more_horiz" color="orange" %}
{% elif substitution or register_object.get_substitution %}
{% include "alsijil/partials/lesson_status_icon.html" with text=_("Substitution") icon="update" color="orange" %}
{% endif %}
{% endif %}
{% load i18n week_helpers %} {% if chip %}
<span class="{% if chip %}chip{% endif %} {{ color }} white-text {{ css_class }}">
{% now_datetime as now_dt %} <i class="material-icons left">
{{ icon }}
{% if has_documentation or register_object.has_documentation %} </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> {{ text }}
{% elif not register_object.period %} </span>
{% period_to_time_start week register_object.raw_period_from_on_day as time_start %}
{% period_to_time_end week register_object.raw_period_to_on_day as time_end %}
{% if now_dt > time_end %}
<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{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Pending" %}" title="{% trans "Pending" %}">more_horiz</i>
{% else %}
<i class="material-icons purple{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Event" %}" title="{% trans "Event" %}">event</i>
{% endif %}
{% else %} {% else %}
{% period_to_time_start week register_object.period as time_start %} <i class="material-icons {{ color }}{% firstof color_suffix "-text" %} tooltipped {{ css_class }}"
{% period_to_time_end week register_object.period as time_end %} data-position="bottom"
data-tooltip="{{ text }}" title="{{ text }}">
{% if substitution.cancelled or register_object.get_substitution.cancelled %} {{ icon }}
<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> </i>
{% elif now_dt > time_end %}
<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{% firstof color_suffix "-text"%} tooltipped {{ css_class }}" data-position="bottom" data-tooltip="{% trans "Pending" %}" title="{% trans "Pending" %}">more_horiz</i>
{% elif substitution or register_object.get_substitution %}
<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 %}
This diff is collapsed.
...@@ -41,8 +41,8 @@ secondary = true ...@@ -41,8 +41,8 @@ secondary = true
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.9" python = "^3.9"
aleksis-core = "^2.0rc" aleksis-core = "^2.2"
aleksis-app-chronos = "^2.0rc" aleksis-app-chronos = "^2.0rc3"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
aleksis-builddeps = "^5" aleksis-builddeps = "^5"
......
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