Skip to content
Snippets Groups Projects

Resolve "Add rules and permissions"

Merged Jonathan Weth requested to merge 73-add-rules-and-permissions into master
Compare and
7 files
+ 468
74
Compare changes
  • Side-by-side
  • Inline
Files
7
{# -*- engine:django -*- #}
{% extends "core/base.html" %}
{% load week_helpers %}
{% load material_form i18n static %}
{% load week_helpers material_form i18n static rules %}
{% block browser_title %}{% blocktrans %}Lesson{% endblocktrans %}{% endblock %}
@@ -29,6 +28,10 @@
{% endblock %}
{% block content %}
{% has_perm "alsijil.view_lessondocumentation" user lesson_period as can_view_lesson_documentation %}
{% has_perm "alsijil.edit_lessondocumentation" user lesson_period as can_edit_lesson_documentation %}
{% has_perm "alsijil.edit_personalnote" user lesson_period as can_edit_personalnote %}
<div class="row">
<div class="col s12">
{% with prev_lesson=lesson_period.prev %}
@@ -52,11 +55,12 @@
<form method="post">
<div class="row">
<div class="col s12">
{% include "core/partials/save_button.html" %}
{% if can_edit_lesson_documentation or can_edit_personalnote %}
{% include "core/partials/save_button.html" %}
{% endif %}
</div>
</div>
{% csrf_token %}
<div class="row">
<div class="col s12 m12 l6 xl8">
{% with prev_lesson=lesson_period.prev prev_doc=prev_lesson.get_lesson_documentation %}
@@ -112,20 +116,44 @@
{% blocktrans %}Lesson documentation{% endblocktrans %}
</span>
{% form form=lesson_documentation_form %}{% endform %}
{% 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>
</table>
{% endif %}
</div>
</div>
</div>
<div class="col s12 m12 l6 xl4">
<div class="card">
<div class="card-content">
{% if can_view_lesson_documentation %}
<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/partials/crud_events.html' with obj=lesson_documentation %}
{% include 'core/partials/crud_events.html' with obj=lesson_documentation %}
</div>
</div>
</div>
</div>
{% endif %}
</div>
<div class="row">
@@ -149,38 +177,48 @@
</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)" %}
{% if can_edit_personalnote %}
<tr>
{{ form.id }}
<td>{{ form.person_name }}{{ form.person_name.value }}</td>
<td class="center-align">
<label>
{{ form.absent }}
<span></span>
</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" %}
</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>
</div>
</td>
</tr>
</td>
<td>
<div class="input-field">
{{ form.remarks }}
<label for="{{ form.absent.id_for_label }}">
{% trans "Remarks" %}
</label>
</div>
</td>
</tr>
{% 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.remarks.value }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
@@ -189,10 +227,12 @@
</div>
</div>
<div class="row">
<div class="col s12">
{% include "core/partials/save_button.html" %}
{% if can_edit_lesson_documentation or can_edit_personalnote %}
<div class="row">
<div class="col s12">
{% include "core/partials/save_button.html" %}
</div>
</div>
</div>
{% endif %}
</form>
{% endblock %}
Loading