3ef253197c8f4742be39443d6b25e4c82a922d3d
[libreplanet-static.git] / 2017 / assets / templates / lp-schedule.jinja2
1 {# -*- mode: jinja2; -*- #}
2 {#
3 Copyright © 2017 lpschedule-generator contributors. See CONTRIBUTORS.
4
5 This file is part of lpschedule-generator.
6
7 lpschedule-generator is free software: you can redistribute it
8 and/or modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation, either version 3 of
10 the License, or (at your option) any later version.
11
12 lpschedule-generator is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with lpschedule-generator (see COPYING). If not, see
19 <http://www.gnu.org/licenses/>.
20 #}
21
22 {# macros start #}
23
24 {# make speakers macro #}
25 {% macro mk_speakers(speakers) %}
26 {% if speakers[0]|lower != 'speakertba' %}
27 <span class="program-session-speaker">
28 {% for speaker in speakers %}
29 {% if loop.last %}
30 {{ speaker }}
31 {% else %}
32 {{ speaker }},
33 {% endif %}
34 {% endfor %}
35 </span>
36 {% endif %}
37 {% endmacro %}
38
39 {# make room macro #}
40 {% macro mk_room(room) %}
41 {% if room|lower != 'roomtba' %}
42 <span class="room label label-default">{{ room }}</span>
43 {% endif %}
44 {% endmacro %}
45
46 {# make day header macro #}
47 {% macro mk_day_header(day, collapse_area) %}
48 {% if day|trim != '' %}
49 <header class="program-day-header">
50 <hgroup>
51 <h2>{{ day }}</h2>
52 </hgroup>
53 </header>
54 {% endif %}
55 {% endmacro %}
56
57 {# make timeslot header macro #}
58 {% macro mk_timeslot_header(timeslot, collapse, collapse_area='') %}
59 {% if timeslot|trim != '' %}
60 <header class="program-timeslot-header">
61 <hgroup>
62 <h2>{{ timeslot }}</h2>
63 </hgroup>
64 </header>
65 {% endif %}
66 {% endmacro %}
67
68 {# make session header macro #}
69 {% macro mk_session_header(session) %}
70 <header class="program-session-header">
71 <hgroup>
72 <h2>{{ session }}</h2>
73 </hgroup>
74 </header>
75 {% endmacro %}
76
77 {# desc macro #}
78 {% macro desc(disc_list) %}
79 {% for desc_p in disc_list %}
80 <p>{{ desc_p }}</p>
81 {% endfor %}
82 {% endmacro %}
83
84 {# populate sessions macro #}
85 {% macro populate_sessions(sessions, day_index, timeslot_index) %}
86 {% for session, session_info in sessions.iteritems() %} {# session start #}
87 <section id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}" class="program-session">
88 {{ mk_session_header(session) }}
89 {{ mk_speakers(session_info['speakers']) }}
90 <p class="program-session-room-details">
91 {{ mk_room(session_info['room']) }}
92 {% if session_info['desc'][0]|lower == 'desctba' %}
93 </p>
94 {% else %}
95 <button class="btn btn-default btn-xs"
96 data-toggle="collapse" aria-expanded="false"
97 aria-controls="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse"
98 data-target="#day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
99 Show details
100 <span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
101 </button>
102 </p>
103 <div class="session-desc collapse in"
104 id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse">
105 {{ desc(session_info['desc']) }}
106 </div> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse end -->
107 {% endif %}
108 </section> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }} end -->
109 {% endfor %} {# session end #}
110 {% endmacro %}
111
112 {# populate timeslots macro #}
113 {% macro populate_timeslots(timeslots, day_index) %}
114 {% for timeslot, sessions in timeslots.iteritems() %} {# timeslot start #}
115 <article id="day-{{ day_index }}-timeslot-{{ loop.index }}" class="program-timeslot">
116 {{ mk_timeslot_header(timeslot) }}
117 {% if sessions|length > 0 %}
118 {{ populate_sessions(sessions, day_index, loop.index) }}
119 {% endif %}
120 </article> <!-- day-{{ day_index }}-timeslot-{{ loop.index }} end -->
121 {% endfor %} {# timeslot start #}
122 {% endmacro %}
123
124 {# lp schedule 2016 template start #}
125 {% for day, timeslots in lp_dict.iteritems() %} {# day start #}
126 <article id="day-{{ loop.index }}-program" class="program-day">
127 {{ mk_day_header(day) }}
128 {{ populate_timeslots(timeslots, loop.index) }}
129 </article> <!-- day-{{ loop.index }} end -->
130 {% endfor %} {# day loop end #}