Skip to content
Snippets Groups Projects
timetable.html 1.13 KiB
Newer Older
Joseph Walton-Rivers's avatar
Joseph Walton-Rivers committed
{% extends "_base.html" %}

{# probably a little overkill ;p #}

{% block content %}

{% for (name, wk_key) in (('Week 1', 'week1'), ('Week 2', 'week2')) %}
<h2 id="{{wk_key}}">{{name}}</h2>

<table class="table text-center">

  <thead>
    <tr class="thead-dark">
      <th></th>
      {% for day in days %}
        <th>{{day|title}}</th>
      {% endfor %}
    </tr>
  </thead>
  
  <tbody>

    {% for (session, key) in sessions.items() %}
    <tr>
      <th class="table-dark">{{session}}</th>
      {% if key in breaks %}
	<td class="table-secondary" colspan="5">{{key|title}}</td>
      {% else %}
        {% for day in days %}
             {% set sess_slug = '{}_{}'.format(day, key) -%}
    
             {% if sess_slug in data[wk_key] %}
		{% if data[wk_key][sess_slug][1] in breaks %}
		<td class="table-secondary">{{data[wk_key][sess_slug][0]}}</td>
		{% else %}
Joseph Walton-Rivers's avatar
Joseph Walton-Rivers committed
		<td>{{data[wk_key][sess_slug][0]}}</td>
Joseph Walton-Rivers's avatar
Joseph Walton-Rivers committed
             {% else %}
                <td class="table-warning">Not defined</td>
             {% endif %}

        {% endfor %}
      {% endif %}

    </tr>
    {% endfor %}

  </tbody>
</table>
{% endfor %}

{% endblock %}