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

Refactor var names and reformat in lesson.html and plan.html

parent e9a568cd
No related branches found
No related tags found
1 merge request!31Biscuit merge. Closes #53.
<div class="card lesson-card"> <div class="card lesson-card">
<div class="card-content"> <div class="card-content">
{# Every element of the lesson #} {# Every element of the lesson #}
{% for element_container in col.elements %} {% for lesson in lessons %}
<div style=" <div style="
{# Display background color only if no badge exists and it is not the old room and there are no holidays #} {# Display background color only if no badge exists and it is not the old room and there are no holidays #}
{% if not element_container.substitution.table.badge %} {% if not lesson.substitution.table.badge %}
{% if not element_container.is_old or type != 1 %} {% if not lesson.is_old or type != 1 %}
{% if not element_container.is_hol %} {% if not lesson.is_hol %}
background-color: {{ element_container.element.subject.hex_color }}; background-color: {{ lesson.element.subject.hex_color }};
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %}" {% endif %}"
{# Add CSS class for sub when it's a sub #} {# Add CSS class for sub when it's a sub #}
class="{% if element_container.substitution %}{% if element_container.substitution.table.is_event %}lesson-with-event{% else %}lesson-with-sub{% endif %}{% endif %}"> class="
<p> {% if lesson.substitution %}{% if lesson.substitution.table.is_event %}lesson-with-event{% else %}lesson-with-sub{% endif %}{% endif %}">
{% if element_container.is_hol %} <p>
{% if lesson.is_hol %}
{# <p><strong>{ element_container.element.holiday_reason }}</strong></p>span class="badge new blue darken-2">Schulfrei</span>#}
{# <p><strong>{ element_container.element.holiday_reason }}</strong></p>span class="badge new blue darken-2">Schulfrei</span>#}
{% elif element_container.substitution %}
{# SUBSTITUTION #} {% elif lesson.substitution %}
{% if type == 1 and element_container.is_old %} {# SUBSTITUTION #}
{# When it's the old room, let it empty #} {% if type == 1 and lesson.is_old %}
{# When it's the old room, let it empty #}
{% elif element_container.substitution.table.badge %}
{# When a badge (cancellation, etc.) exists, then display it with the teacher#} {% elif lesson.substitution.table.badge %}
{# When a badge (cancellation, etc.) exists, then display it with the teacher#}
{# Class or room > Display teacher #}
{% if type == 2 or type == 1 %} {# Class or room > Display teacher #}
{% if element_container.element.teacher %} {% if type == 2 or type == 1 %}
<span data-position="bottom" class="tooltipped" {% if lesson.element.teacher %}
data-tooltip="{{ element_container.element.teacher }}"> <span data-position="bottom" class="tooltipped"
data-tooltip="{{ lesson.element.teacher }}">
<a <a
href="{% url "timetable_smart_plan" "teacher" element_container.element.teacher.id %}">{{ element_container.element.teacher.shortcode }}</a> href="{% url "timetable_smart_plan" "teacher" lesson.element.teacher.id %}">{{ lesson.element.teacher.shortcode }}</a>
</span> </span>
<br> <br>
{% endif %} {% endif %}
{% endif %} {% endif %}
{# Badge #} {# Badge #}
<span class="badge new green darken-2">{{ element_container.substitution.table.badge }}</span> <span class="badge new green darken-2">{{ lesson.substitution.table.badge }}</span>
{% else %} {% else %}
{# Display sub #} {# Display sub #}
{% with sub=element_container.substitution.table %} {% with sub=lesson.substitution.table %}
{# Teacher or room > display classes #} {# Teacher or room > display classes #}
{% if type == 0 or type == 1 %} {% if type == 0 or type == 1 %}
{{ element_container.substitution.table.classes }} {{ lesson.substitution.table.classes }}
{% endif %} {% endif %}
{# Display teacher with tooltip #} {# Display teacher with tooltip #}
{% include "timetable/subs/teacher.html" %} {% include "timetable/subs/teacher.html" %}
{# Display subject #} {# Display subject #}
{% include "timetable/subs/subject.html" %} {% include "timetable/subs/subject.html" %}
{# Teacher or class > display room #} {# Teacher or class > display room #}
{% if type == 0 or type == 2 %} {% if type == 0 or type == 2 %}
{% include "timetable/subs/room.html" %} {% include "timetable/subs/room.html" %}
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{# When it isn't a room or the old plan, then display the extra text (e. g. work orders) AND NOT A EVENT#} {# When it isn't a room or the old plan, then display the extra text (e. g. work orders) AND NOT A EVENT#}
{% if not element_container.substitution.table.is_event %} {% if not lesson.substitution.table.is_event %}
{% if not type == 1 or not element_container.is_old %} {% if not type == 1 or not lesson.is_old %}
<br> <br>
<small> <small>
<em>{{ element_container.substitution.table.text|default:"" }}</em> <em>{{ lesson.substitution.table.text|default:"" }}</em>
</small> </small>
{% endif %} {% endif %}
{% endif %} {% endif %}
{# Display the extra text for events #} {# Display the extra text for events #}
{% if element_container.substitution.table.is_event %} {% if lesson.substitution.table.is_event %}
{% if type == 0 and element_container.substitution.table.classes == "" and element_container.substitution.table.rooms|length == 0 and element_container.substitutions.table.teachers|length == 0 %} {% if type == 0 and lesson.substitution.table.classes == "" and lesson.substitution.table.rooms|length == 0 and lesson.substitutions.table.teachers|length == 0 %}
<em>{{ element_container.substitution.table.text|default:"" }}</em> <em>{{ lesson.substitution.table.text|default:"" }}</em>
{% elif type == 2 and element_container.substitution.table.teachers|length == 0 and element_container.substitution.table.rooms|length == 0 %} {% elif type == 2 and lesson.substitution.table.teachers|length == 0 and lesson.substitution.table.rooms|length == 0 %}
<em>{{ element_container.substitution.table.text|default:"" }}</em> <em>{{ lesson.substitution.table.text|default:"" }}</em>
{% elif type == 1 and element_container.substitution.table.teachers|length == 0 and element_container.substitution.table.classes == "" %} {% elif type == 1 and lesson.substitution.table.teachers|length == 0 and lesson.substitution.table.classes == "" %}
<em>{{ element_container.substitution.table.text|default:"" }}</em> <em>{{ lesson.substitution.table.text|default:"" }}</em>
{% else %} {% else %}
<br> <br>
<small> <small>
<em>{{ element_container.substitution.table.text|default:"" }}</em> <em>{{ lesson.substitution.table.text|default:"" }}</em>
</small> </small>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% else %} {% else %}
{# Normal plan #} {# Normal plan #}
{# Teacher or room > Display classes #} {# Teacher or room > Display classes #}
{% if type == 0 or type == 1 %} {% if type == 0 or type == 1 %}
{# {{ element_container.element.classes }}#} {# {{ element_container.element.classes }}#}
{% if element_container.element.classes %} {% if lesson.element.classes %}
<a href="{% url "timetable_smart_plan" "class" element_container.element.classes.0.id %}"> <a href="{% url "timetable_smart_plan" "class" lesson.element.classes.0.id %}">
{{ element_container.classes_formatted }} {{ lesson.classes_formatted }}
</a> </a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{# Class or room > Display teacher #} {# Class or room > Display teacher #}
{% if type == 2 or type == 1 %} {% if type == 2 or type == 1 %}
{% if element_container.element.teacher %} {% if lesson.element.teacher %}
<span data-position="bottom" class="tooltipped" <span data-position="bottom" class="tooltipped"
data-tooltip="{{ element_container.element.teacher }}"> data-tooltip="{{ lesson.element.teacher }}">
<a href="{% url "timetable_smart_plan" "teacher" element_container.element.teacher.id %}"> <a href="{% url "timetable_smart_plan" "teacher" lesson.element.teacher.id %}">
{{ element_container.element.teacher.shortcode }} {{ lesson.element.teacher.shortcode }}
</a> </a>
</span> </span>
{% endif %} {% endif %}
{% endif %} {% endif %}
{# Display subject #} {# Display subject #}
<strong>{{ element_container.element.subject.shortcode }}</strong> <strong>{{ lesson.element.subject.shortcode }}</strong>
{# Teacher or class > Display room #} {# Teacher or class > Display room #}
{% if type == 0 or type == 2 %} {% if type == 0 or type == 2 %}
<span class="tooltipped" data-position="bottom" <span class="tooltipped" data-position="bottom"
data-tooltip="{{ element_container.room.name }}"> data-tooltip="{{ lesson.room.name }}">
{% if element_container.room %} {% if lesson.room %}
<a href="{% url "timetable_smart_plan" "room" element_container.room.id %}"> <a href="{% url "timetable_smart_plan" "room" lesson.room.id %}">
{{ element_container.room.shortcode }} {{ lesson.room.shortcode }}
</a> </a>
{% endif %} {% endif %}
</span> </span>
{% endif %} {% endif %}
{% endif %} {% endif %}
</p> </p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
...@@ -211,10 +211,10 @@ ...@@ -211,10 +211,10 @@
</div> </div>
</div> </div>
{% for weekday, lesson in lesson_periods_period.items %} {% for weekday, lessons in lesson_periods_period.items %}
{# A lesson #} {# A lesson #}
<div class="col s2"> <div class="col s2">
{% include "chronos/lesson.html" %} {% include "chronos/lesson.html" with lessons=lessons %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
......
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