lpschedule-generator

libreplanet schedule generator - ricketyspace.net/lpschedule-generator
git clone git://git.ricketyspace.net/lpschedule-generator.git
Log | Files | Refs

lp-schedule.jinja2 (4590B)


      1 {# -*- mode: jinja2; -*- #}
      2 {#
      3     SPDX-License-Identifier: CC0-1.0
      4 
      5     This file is part of lpschedule-generator.
      6 #}
      7 
      8 {# macros start #}
      9 
     10 {# make speakers macro #}
     11 {% macro mk_speakers(speakers) %}
     12   {% if speakers[0]|lower != 'speakertba' %}
     13     <div class="program-session-speaker">
     14       {% for speaker in speakers %}
     15         {% if loop.last %}
     16           {{ speaker }}
     17         {% else %}
     18           {{ speaker }},
     19         {% endif %}
     20       {% endfor %}
     21     </div>
     22   {% endif %}
     23 {% endmacro %}
     24 
     25 {# make room macro #}
     26 {% macro mk_room(room) %}
     27   {% if room|lower != 'roomtba' %}
     28     <div class="program-session-room-details">
     29       <span class="room label label-default">{{ room }}</span>
     30     </div>
     31   {% endif %}
     32 {% endmacro %}
     33 
     34 {# make video macro #}
     35 {% macro mk_video(video) %}
     36   {% if video|lower != 'videotba' %}
     37     <a class="btn btn-default btn-xs" href="{{ video }}">
     38       <span class="glyphicon glyphicon-facetime-video"></span>
     39     </a>
     40   {% endif %}
     41 {% endmacro %}
     42 
     43 {# make desc details button macro #}
     44 {% macro mk_desc_details_btn(disc_list) %}
     45   {% if disc_list[0]|lower != 'desctba' %}
     46     <button class="btn btn-default btn-xs"
     47             data-toggle="collapse" aria-expanded="false"
     48             aria-controls="{{ caller()|trim }}"
     49             data-target="#{{ caller()|trim }}">
     50             Show details
     51             <span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
     52     </button>
     53   {% endif %}
     54 {% endmacro %}
     55 
     56 {% macro mk_desc(disc_list) %}
     57   {% if disc_list[0]|lower != 'desctba' %}
     58     <div class="session-desc collapse in"
     59          id="{{ caller()|trim }}">
     60          {{ desc(disc_list) }}
     61     </div> <!--  {{ caller()|trim }} end -->
     62   {% endif %}
     63 {% endmacro %}
     64 
     65 {# make day header macro #}
     66 {% macro mk_day_header(day, collapse_area) %}
     67   {% if day|trim != '' %}
     68     <header class="program-day-header">
     69       <hgroup>
     70         <h2>{{ day }}</h2>
     71       </hgroup>
     72     </header>
     73   {% endif %}
     74 {% endmacro %}
     75 
     76 {# make timeslot header macro #}
     77 {% macro mk_timeslot_header(timeslot, collapse, collapse_area='') %}
     78   {% if timeslot|trim != '' %}
     79     <header class="program-timeslot-header">
     80       <hgroup>
     81         <h2>{{ timeslot }}</h2>
     82       </hgroup>
     83     </header>
     84   {% endif %}
     85 {% endmacro %}
     86 
     87 {# make session header macro #}
     88 {% macro mk_session_header(session) %}
     89   {% if session|trim not in ['', 'st-from-ts'] %}
     90     <header class="program-session-header">
     91       <hgroup>
     92         <h2>{{ session }}</h2>
     93       </hgroup>
     94   </header>
     95   {% endif %}
     96 {% endmacro %}
     97 
     98 {# desc macro #}
     99 {% macro desc(disc_list) %}
    100   {% for desc_p in disc_list %}
    101     <p>{{ desc_p }}</p>
    102   {% endfor %}
    103 {% endmacro %}
    104 
    105 {# populate sessions macro #}
    106 {% macro populate_sessions(sessions, day_index, timeslot_index) %}
    107   {% for session, session_info in sessions.iteritems() %} {# session start #}
    108     <section id="day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}" class="program-session">
    109       {{ mk_session_header(session) }}
    110       {{ mk_speakers(session_info['speakers']) }}
    111       <div class="program-session-shelf">
    112         {{ mk_room(session_info['room']) }}
    113         {{ mk_video(session_info['video']) }}
    114         {% call mk_desc_details_btn(session_info['desc']) %}
    115           day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse
    116         {% endcall %}
    117       </div>
    118 
    119       <div class="program-session-desc-block">
    120         {% call mk_desc(session_info['desc']) %}
    121           day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }}-collapse
    122         {% endcall %}
    123       </div>
    124     </section> <!-- day-{{ day_index }}-timeslot-{{ timeslot_index }}-session-{{ loop.index }} end -->
    125   {% endfor %} {# session end #}
    126 {% endmacro %}
    127 
    128 {# populate timeslots macro #}
    129 {% macro populate_timeslots(timeslots, day_index) %}
    130   {% for timeslot, sessions in timeslots.iteritems() %}  {# timeslot start #}
    131     <article id="day-{{ day_index }}-timeslot-{{ loop.index }}" class="program-timeslot">
    132       {{ mk_timeslot_header(timeslot) }}
    133       {% if sessions|length > 0 %}
    134              {{ populate_sessions(sessions, day_index, loop.index) }}
    135       {% endif %}
    136     </article> <!-- day-{{ day_index }}-timeslot-{{ loop.index }} end -->
    137   {% endfor %} {# timeslot start #}
    138 {% endmacro %}
    139 
    140 {# lp schedule 2016 template start #}
    141 {% for day, timeslots in lp_dict.iteritems() %} {# day start #}
    142   <article id="day-{{ loop.index }}-program" class="program-day">
    143     {{ mk_day_header(day) }}
    144       {{ populate_timeslots(timeslots, loop.index) }}
    145   </article> <!-- day-{{ loop.index }} end -->
    146 {% endfor %} {# day loop end #}