calendar-week.html.twig in Calendar 8.2
Same filename and directory in other branches
Template to display a view as a calendar month.
Available variables:
- rows: An array of data.
File
templates/calendar-week.html.twigView source
- {#
- /**
-  * @file
-  * Template to display a view as a calendar month.
-  *
-  * Available variables:
-  * - rows: An array of data.
-  *
-  */
- #}
- 
- {{ attach_library('calendar/calendar') }}
- <div class="calendar week">
-   <div class="labels">
-     <div class="weekno">
-       {% for weekcounter,row in rows %}
-       {{ row.linkdata.week }}
-       {% endfor %}
-     </div>
-     <div class="hour-label">
-       {% for weekcounter,row in rows %}
-         {% for day in row.weekdays %}
-           {% if loop.first  %}
-             {% for key,value in day.other %}
-               <div class="label">{{ "%05.2f"|format(key) }}</div>
-             {% endfor %}
-           {% endif %}
-         {% endfor %}
-       {% endfor %}
-     </div>
-   </div>
- 
-   <div class="data">
-     <div class="headings">
-       {% for weekcounter,row in rows %}
-         {% for key,value in row.weekdays %}
-           <div class="day {{ key }} {{ value.class }}">
-             {% if row.linkdata.day_route %}
-               <div class="date"><a href="{{ path(row.linkdata.day_route, {'arg_0': row.linkdata.year ~ row.linkdata.month ~ value.date }) }}">{{ value.date }}</a></div>
-             {% else %}
-               {{ value.date }}
-             {% endif %}
-             <div class="header">{{ value.header }}</div>
-           </div>
-         {% endfor %}
-       {% endfor %}
-     </div>
- 
-     {# multiday events are rendered first #}
-     <div class="multidays">
-       {% for weekcounter,row in rows %}
-         {% for day in row.weekdays %}
-           {% for event in day.multiday %}
- {#            {% if event.offset.h > 0 %}#}
- {#              {% set offset = (event.offset.d + 1) * 100 / 7 %}#}
- {#            {% else %}#}
-               {% set offset = event.offset.d * 100 / 7 %}
- {#            {% endif %}#}
-             {% if event.length.h > 0 %}
-               {% set length = (event.length.d + 1) * 100 / 7 %}
-             {% else %}
-               {% set length = event.length.d * 100 / 7 %}
-             {% endif %}
-             {% if length is same as(0) %}
-               <div class="multiday" style="margin-left: {{ offset }}%; width: auto;"><div class="inner">{{- event.label -}}</div></div>
-             {% else %}
-               <div class="multiday" style="margin-left: {{ offset }}%; width: {{ length }}%;"><div class="inner">{{- event.label -}}</div></div>
-             {% endif %}
-           {% endfor %}
-         {% endfor %}
-       {% endfor %}
-     </div>
- 
-     {# next allday events #}
-     <div class="alldays">
-       {% for weekcounter,row in rows %}
-         {% for key,value in row.weekdays %}
-           <div class="day {{ key }} {{ value.class }}">
-     {#          {{ row.date }}#}
-             {% for event in value.allday %}
-               <div class="allday"><div class="inner">{{- event.label -}}</div></div>
-             {% endfor %}
-           </div>
-         {% endfor %}
-       {% endfor %}
-     </div>
- 
-     {# render other events based on time and duration #}
-     <div class="otherdays">
-       {% for weekcounter,row in rows %}
-         {% for key,value in row.weekdays %}
-           <div class="day {{ key }} {{ value.class }}">
-             <div class="labels">
-               {% for events in value.other %}
-                 <div class="label">
-                   {% if events is not empty %}
-                     {% for event in events %}
-                       {% set height = event.length.h * 1.6 %}
-                       <div class="hour"><div class="event" style="height: {{ height }}rem; margin-left: {{ loop.index0 }}rem; background-color: {{ event.color }};">{{- event.row -}}</div></div>
-                     {% endfor %}
-                   {% else %}
-                      
-                   {% endif %}
-                 </div>
-               {% endfor %}
- 
-             </div>
-           </div>
-         {% endfor %}
-       {% endfor %}
-     </div>
-   </div>
- </div>
