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

Merge branch 'fix/design' into 'master'

Review use of Materialize

Closes #61

See merge request !48
parents 772ea75c 053893ba
No related branches found
No related tags found
1 merge request!48Review use of Materialize
Pipeline #2729 passed
Showing with 214 additions and 170 deletions
......@@ -8,7 +8,8 @@ from django.utils.translation import gettext_lazy as _
from django_select2.forms import Select2Widget
from aleksis.apps.chronos.models import Room
from material import Row, Layout
from aleksis.core.models import Group, Person
from .models import LessonDocumentation, PersonalNote, PersonalNoteFilter
......@@ -32,12 +33,15 @@ class PersonalNoteForm(forms.ModelForm):
self.fields["person_name"].widget.attrs.update(
{"class": "alsijil-lesson-personal-note-name"}
)
self.fields["person_name"].widget = forms.HiddenInput()
if self.instance and getattr(self.instance, "person", None):
self.fields["person_name"].initial = str(self.instance.person)
class SelectForm(forms.Form):
layout = Layout(Row("group", "teacher"))
group = forms.ModelChoiceField(
queryset=Group.objects.annotate(lessons_count=Count("lessons")).filter(lessons_count__gt=0),
label=_("Group"),
......@@ -77,11 +81,17 @@ PersonalNoteFormSet = forms.modelformset_factory(
class RegisterAbsenceForm(forms.Form):
layout = Layout(Row("date_start", "date_end"),
Row("from_period"),
Row("absent", "excused"),
Row("person"),
Row("remarks")
)
date_start = forms.DateField(
label=_("Start date"), widget=forms.SelectDateWidget, initial=datetime.today
label=_("Start date"), initial=datetime.today
)
date_end = forms.DateField(
label=_("End date"), widget=forms.SelectDateWidget, initial=datetime.today
label=_("End date"), initial=datetime.today
)
from_period = forms.IntegerField(label=_("From period"), initial=0, min_value=0)
person = forms.ModelChoiceField(
......@@ -93,6 +103,8 @@ class RegisterAbsenceForm(forms.Form):
class PersonalNoteFilterForm(forms.ModelForm):
layout = Layout(Row("identifier", "description"), Row("regex"))
class Meta:
model = PersonalNoteFilter
fields = ["identifier", "description", "regex"]
table.datatable a {
color: inherit !important;
}
table a.tr-link {
display: block;
width: inherit;
height: inherit;
}
input.alsijil-lesson-personal-note-name:disabled {
background-color: transparent;
border: 0;
color: #212529;
}
.alsijil-lesson-cancelled {
text-decoration: line-through;
}
@media only screen and (max-width : 992px) {
table.responsive-table.alsijil-table th,
table.responsive-table.alsijil-table td {
margin: 0;
vertical-align: top;
height: 109px;}
}
/*
* Copyright (c) 2015 Tsutomu Kawamura
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
@page { margin: 0 }
body { margin: 0 }
.sheet {
margin: 0;
overflow: hidden;
position: relative;
box-sizing: border-box;
page-break-after: always;
}
/** Paper sizes **/
body.A3 .sheet { width: 297mm; min-height: 419mm }
body.A3.landscape .sheet { width: 420mm; min-height: 296mm }
body.A4 .sheet { width: 210mm; min-height: 296mm }
body.A4.landscape .sheet { width: 297mm; min-height: 209mm }
body.A5 .sheet { width: 148mm; min-height: 209mm }
body.A5.landscape .sheet { width: 210mm; min-height: 147mm }
body.letter .sheet { width: 216mm; min-height: 279mm }
body.letter.landscape .sheet { width: 280mm; min-height: 215mm }
body.legal .sheet { width: 216mm; min-height: 356mm }
body.legal.landscape .sheet { width: 357mm; min-height: 215mm }
/** Padding area **/
.sheet.padding-10mm { padding: 10mm }
.sheet.padding-15mm { padding: 15mm }
.sheet.padding-20mm { padding: 20mm }
.sheet.padding-25mm { padding: 25mm }
/** For screen preview **/
@media screen {
body { background: #e0e0e0 }
.sheet {
background: white;
box-shadow: 0 .5mm 2mm rgba(0,0,0,.3);
margin: 5mm auto;
}
}
/** Fix for Chrome issue #273306 **/
@media print {
body.A3.landscape { width: 420mm }
body.A3, body.A4.landscape { width: 297mm }
body.A4, body.A5.landscape { width: 210mm }
body.A5 { width: 148mm }
body.letter, body.legal { width: 216mm }
body.letter.landscape { width: 280mm }
body.legal.landscape { width: 357mm }
}
......@@ -6,9 +6,14 @@ from django_tables2.utils import A
class PersonalNoteFilterTable(tables.Table):
class Meta:
attrs = {"class": "table table-striped table-bordered table-hover table-responsive-xl"}
attrs = {"class": "highlight"}
identifier = tables.Column()
description = tables.Column()
regex = tables.Column()
edit_filter = tables.LinkColumn("edit_personal_note_filter", args=[A("id")], text=_("Edit"))
edit_filter = tables.LinkColumn(
"edit_personal_note_filter",
args=[A("id")],
text=_("Edit"),
attrs={"a": {"class": "btn-flat waves-effect waves-orange"}},
)
......@@ -10,7 +10,7 @@
<form method="post">
{% csrf_token %}
{% form form=register_absence_form %}{% endform %}
{% include "core/save_button.html" %}
{% include "core/partials/save_button.html" %}
</form>
{% endblock %}
......@@ -6,14 +6,14 @@
{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'css/alsijil/lesson.css' %}" />
<link rel="stylesheet" href="{% static 'css/alsijil/lesson.css' %}"/>
{% endblock %}
{% block page_title %}
{{ day }} -
{{ day }}, {% blocktrans with period=lesson_period.period.period %}{{ period }}. period{% endblocktrans %} –
{% for group in lesson_period.get_groups.all %}
<span>{{ group.short_name }}</span>,
<span>{{ group.name }}</span>,
{% endfor %}
{{ lesson_period.get_subject.name }},
......@@ -25,54 +25,102 @@
{% block content %}
<form method="post">
<div class="row">
<div class="col s12">
{% include "core/partials/save_button.html" %}
</div>
</div>
{% csrf_token %}
<div class="row">
<div class="col s8">
<div class="card dark-text">
<div class="col s12 m12 l6 xl8">
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Lesson documentation{% endblocktrans %}
</span>
{% form form=lesson_documentation_form %}{% endform %}
</div>
{% csrf_token %}
{% form form=lesson_documentation_form %}{% endform %}
</div>
</div>
<div class="col s4">
<div class="card dark-text">
<div class="col s12 m12 l6 xl4">
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Change history{% endblocktrans %}
</span>
{% include 'core/crud_events_ul.html' with class_ul='list-group list-group-flush' class_li='list-group-item d-flex justify-content-between align-items-center' obj=lesson_documentation %}
{% include 'core/partials/crud_events.html' with obj=lesson_documentation %}
</div>
</div>
</div>
</div>
<div class="card dark-text">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<span class="card-title">
{% blocktrans %}Personal notes{% endblocktrans %}
</span>
{{ personal_note_formset.management_form }}
{% form form=personal_note_formset.management_form %}{% endform %}
<table class="striped responsive-table">
<tr>
<th>{% blocktrans %}Person{% endblocktrans %}</th>
<th>{% blocktrans %}Absent{% endblocktrans %}</th>
<th>{% blocktrans %}Tardiness{% endblocktrans %}</th>
<th>{% blocktrans %}Excused{% endblocktrans %}</th>
<th>{% blocktrans %}Remarks{% endblocktrans %}</th>
</tr>
{% for form in personal_note_formset %}
{{ form.id }}
<tr>
<td>{{ form.person_name }}</td>
<td>{{ form.absent }}</td>
<td>{{ form.late }}</td>
<td>{{ form.excused }}</td>
<td>{{ form.remarks }}</td>
</tr>
{% endfor %}
</table>
<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 %}Remarks{% endblocktrans %}</th>
</tr>
</thead>
<tbody>
{% for form in personal_note_formset %}
<tr>
{{ form.id }}
<td>{{ form.person_name }}{{ form.person_name.value }}</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.remarks }}
<label for="{{ form.absent.id_for_label }}">
{% trans "Remarks" %}
</label>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
{% include "core/partials/save_button.html" %}
</div>
</div>
{% include "core/save_button.html" %}
</form>
{% endblock %}
......@@ -7,51 +7,53 @@
{% block extra_head %}
{{ block.super }}
<link rel="stylesheet" href="{% static 'css/alsijil/alsijil.css' %}" />
<link rel="stylesheet" href="{% static 'css/alsijil/alsijil.css' %}"/>
{% endblock %}
{% block content %}
<div class="row">
<div class="col s10">
<form method="get">
<ul id="timetable_select_form">
<div class="row">
{% if group %}
<div class="col s12 m2 push-m10 l1 push-l11">
<a class="col s12 btn waves-effect waves-light right" href="{% url 'full_register_group' group.id %}">
<i class="material-icons center">print</i>
</a>
</div>
{% endif %}
<div class="col s12 {% if group %}m10 pull-m2 l11 pull-l1 {% endif %}">
<form method="post" action="">
{% csrf_token %}
{% form form=select_form %}{% endform %}
</ul>
<button type="submit" class="btn waves-effect waves-light">
{% blocktrans %}Select{% endblocktrans %}
</button>
</form>
</div>
{% if group %}
<div class="col s2">
<a class="btn waves-effect waves-light" href="{% url 'full_register_group' group.id %}">
<i class="material-icons">printer</i>
</a>
<button type="submit" class="btn waves-effect waves-light">
{% blocktrans %}Select{% endblocktrans %}
</button>
</form>
</div>
{% endif %}
</div>
</div>
<h4>{% blocktrans with el=el week=week.week %}CW {{ week }}: {{ instance }}{% endblocktrans %} </h4>
{% if lesson_periods.count %}
{% if lesson_periods %}
<div class="row">
<div class="col s7">
<div class="col s12 m7">
{% 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-content">
{% weekday_to_date week periods.0.period.weekday as current_date %}
<span class="card-title">
{{ weekday }}
{{ weekday }}, {{ current_date }}
</span>
<table class="striped responsive-table datatable">
<table class="striped datatable">
<thead>
<tr>
<th>{% blocktrans %}Period{% endblocktrans %}</th>
<th>{% blocktrans %}Subject{% endblocktrans %}</th>
<th>{% blocktrans %}Teachers{% endblocktrans %}</th>
</tr>
<tr>
<th>{% blocktrans %}Period{% endblocktrans %}</th>
<th>{% blocktrans %}Subject{% endblocktrans %}</th>
<th>{% blocktrans %}Teachers{% endblocktrans %}</th>
</tr>
</thead>
<tbody>
{% for period in periods %}
<tr class="
{% for period in periods %}
<tr class="
{% if period.has_documentation %}
success
{% else %}
......@@ -69,22 +71,30 @@
{% endif %}
{% endif %}
">
<td>{{ period.period.period }}</td>
<td>
<a href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{{ period.get_subject.name }}
</a>
</td>
<td>{{ period.get_teacher_names }}</td>
</tr>
{% endfor %}
<td class="tr-link">
<a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{{ period.period.period }}.
</a>
</td>
<td>
<a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{{ period.get_subject.name }}
</a>
</td>
<td>
<a class="tr-link" href="{% url 'lesson_by_week_and_period' week.year week.week period.id %}">
{{ period.get_teacher_names }}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endfor %}
</div>
<div class="col s5">
<div class="col s12 m5">
<div class="card">
<div class="card-content">
<span class="card-title">
......@@ -93,20 +103,22 @@
{% for person in persons %}
<h5 class="card-title">{{ person.full_name }}</h5>
<p class="card-text">
{% trans "Absent" %}: {{ person.absences }}
({{ person.unexcused }} {% trans "unexcused" %})
{% trans "Absent" %}: {{ person.absences_count }}
({{ person.unexcused_count }} {% trans "unexcused" %})
</p>
<p class="card-text">
{% trans "Summed up tardiness" %}: {{ person.tardiness }}
{% trans "Summed up tardiness" %}: {{ person.tardiness_sum }}'
</p>
{% for note in person.personal_notes|only_week:week %}
{% if note.remarks %}
<blockquote class="blockquote mb-0">
<blockquote>
{{ note.remarks }}
<footer class="blockquote-footer">
{% weekday_to_date week note.lesson_period.period.weekday as note_date %}
{{ note_date }}, {{ note.lesson_period.lesson.subject.name }}
</footer>
{% weekday_to_date week note.lesson_period.period.weekday as note_date %}
<em class="right">
<a href="{% url 'lesson_by_week_and_period' week.year week.week note.lesson_period.id %}">
{{ note_date }}, {{ note.lesson_period.get_subject.name }}
</a>
</em>
</blockquote>
{% endif %}
{% endfor %}
......@@ -123,10 +135,22 @@
</span>
<p>
{% blocktrans %}
There are no lessons for the selected group, teacher, room or time.
There are no lessons for the selected group, teacher or time.
{% endblocktrans %}
</p>
</div>
</div>
{% endif %}
<script>
$(document).ready(function () {
$("#id_group").change(function () {
$("#id_teacher").val("").formSelect();
});
$("#id_teacher").change(function () {
$("#id_group").val("").formSelect();
});
});
</script>
{% endblock %}
......@@ -4,12 +4,12 @@
{% load i18n %}
{% load render_table from django_tables2 %}
{% block browser_title %}{% blocktrans %}List of all personal note filters{% endblocktrans %}{% endblock %}
{% block page_title %}{% blocktrans %}List of all personal note filters{% endblocktrans %}{% endblock %}
{% block browser_title %}{% blocktrans %}All personal note filters{% endblocktrans %}{% endblock %}
{% block page_title %}{% blocktrans %}Personal note filters{% endblocktrans %}{% endblock %}
{% block content %}
<a href="{% url 'create_personal_note_filter' %}" class="waves-effect waves-dark green btn">
<i class="material-icons">add</i>{% blocktrans %}Add filter{% endblocktrans %}
<a href="{% url 'create_personal_note_filter' %}" class="waves-effect waves-light green btn">
<i class="material-icons left">add</i>{% blocktrans %}Add filter{% endblocktrans %}
</a>
{% render_table personal_note_filters_table %}
......
......@@ -2,20 +2,33 @@
{% extends "core/base.html" %}
{% load material_form i18n static %}
{% block browser_title %}{% blocktrans %}Manage personal note filter{% endblocktrans %}{% endblock %}
{% block page_title %}{% blocktrans %}Manage personal note filter{% endblocktrans %}{% endblock %}
{% block content %}
{% block browser_title %}
{% if personal_note_filter %}
{% trans "Update personal note filter" %}
{% else %}
{% trans "Create personal note filter" %}
{% endif %}
{% endblock %}
{% block page_title %}
{% if personal_note_filter %}
<a href="{% url 'delete_personal_note_filter' personal_note_filter.id %}" class="waves-effect waves-dark btn red">
<i class="material-icons">delete</i>{% blocktrans %}Delete filter{% endblocktrans %}
</a>
{% trans "Update personal note filter" %}
{% else %}
{% trans "Create personal note filter" %}
{% endif %}
{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
{% form form=personal_note_filter_form %}{% endform %}
{% include "core/save_button.html" %}
{% include "core/partials/save_button.html" %}
{% if personal_note_filter %}
<a href="{% url 'delete_personal_note_filter' personal_note_filter.id %}"
class="waves-effect waves-light btn red">
<i class="material-icons left">delete</i>{% blocktrans %}Delete filter{% endblocktrans %}
</a>
{% endif %}
</form>
{% endblock %}
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