summaryrefslogtreecommitdiffstats
path: root/libreplanet-templates/2017/lp-schedule.jinja2
blob: 454a3c51155f20268481c600cf89251d6ede5fd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{# -*- mode: jinja2; -*- #}
{#
    SPDX-License-Identifier: CC0-1.0

    This file is part of lpschedule-generator.
#}

{# macros start #}

{# make speakers macro #}
{% macro mk_speakers(speakers) %}
  {% if speakers[0]|lower != 'speakertba' %}
    <span class="program-session-speaker">
      {% for speaker in speakers %}
        {% if loop.last %}
          {{ speaker }}
        {% else %}
          {{ speaker }},
        {% endif %}
      {% endfor %}
    </span>
  {% endif %}
{% endmacro %}

{# make room macro #}
{% macro mk_room(room) %}
  {% if room|lower != 'roomtba' %}
    <span class="room label label-default">{{ room }}</span>
  {% endif %}
{% endmacro %}

{# make day header macro #}
{% macro mk_day_header(day, collapse_area) %}
  {% if day|trim != '' %}
    <header class="program-day-header">
      <hgroup>
        <h2>{{ day }}</h2>
      </hgroup>
    </header>
  {% endif %}
{% endmacro %}

{# make timeslot header macro #}
{% macro mk_timeslot_header(timeslot, collapse, collapse_area='') %}
  {% if timeslot|trim != '' %}
    <header class="program-timeslot-header">
      <hgroup>
        <h2>{{ timeslot }}</h2>
      </hgroup>
    </header>
  {% endif %}
{% endmacro %}

{# make session header macro #}
{% macro mk_session_header(session) %}
  <header class="program-session-header">
    <hgroup>
      <h2>{{ session }}</h2>
    </hgroup>
  </header>
{% endmacro %}

{# desc macro #}
{% macro desc(disc_list) %}
  {% for desc_p in disc_list %}
    <p>{{ desc_p }}</p>
  {% endfor %}
{% endmacro %}

{# populate sessions macro #}
{% macro populate_sessions(sessions, day_index, timeslot_index) %}
  {% for session, session_info in sessions.iteritems() %} {# session start #}
    <section id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}" class="program-session">
      {{ mk_session_header(session) }}
      {{ mk_speakers(session_info['speakers']) }}
      <p class="program-session-room-details">
        {{ mk_room(session_info['room']) }}
        {% if session_info['desc'][0]|lower == 'desctba' %}
          </p>
        {% else %}
          <button class="btn btn-default btn-xs"
                  data-toggle="collapse" aria-expanded="false"
                  aria-controls="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"
                  data-target="#day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
                  Show details
                  <span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
          </button>
          </p>
          <div class="session-desc collapse in"
               id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
               {{ desc(session_info['desc']) }}
          </div> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse end -->
        {% endif %}
    </section> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }} end -->
  {% endfor %} {# session end #}
{% endmacro %}

{# populate timeslots macro #}
{% macro populate_timeslots(timeslots, day_index) %}
  {% for timeslot, sessions in timeslots.iteritems() %}  {# timeslot start #}
    <article id="day-{{ day_index }}-timeslot-{{ loop.index }}" class="program-timeslot">
      {{ mk_timeslot_header(timeslot) }}
      {% if sessions|length > 0 %}
             {{ populate_sessions(sessions, day_index, loop.index) }}
      {% endif %}
    </article> <!-- day-{{ day_index }}-timeslot-{{ loop.index }} end -->
  {% endfor %} {# timeslot start #}
{% endmacro %}

{# lp schedule 2016 template start #}
{% for day, timeslots in lp_dict.iteritems() %} {# day start #}
  <article id="day-{{ loop.index }}-program" class="program-day">
    {{ mk_day_header(day) }}
      {{ populate_timeslots(timeslots, loop.index) }}
  </article> <!-- day-{{ loop.index }} end -->
{% endfor %} {# day loop end #}