You are here

calendar-day.html.twig in Calendar 8.2

Same filename and directory in other branches
  1. 8 templates/calendar-day.html.twig

Template to display a view as a calendar month.

Available variables:

  • rows: An array of data.

File

templates/calendar-day.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template to display a view as a calendar month.
  5. *
  6. * Available variables:
  7. * - rows: An array of data.
  8. *
  9. */
  10. #}
  11. {{ attach_library('calendar/calendar') }}
  12. <div class="calendar day">
  13. <div class="data">
  14. <div class="headings">
  15. {% for weekcounter,row in rows %}
  16. <div class="weekno">
  17. {% if(row.linkdata.week_route) %}
  18. <a href="{{ path(row.linkdata.week_route, {'arg_0': row.linkdata.year ~ row.linkdata.week }) }}">{{ row.linkdata.week }}</a>
  19. {% endif %}
  20. </div>
  21. {% for day in row.weekdays %}
  22. {% if loop.first %}
  23. <div class="date">{{ day.date }}</div>
  24. <div class="header">{{ day.header }}</div>
  25. {% endif %}
  26. {% endfor %}
  27. {% endfor %}
  28. </div>
  29. {# multiday events are rendered first #}
  30. <div class="multidays">
  31. {% for weekcounter,row in rows %}
  32. {% for day in row.weekdays %}
  33. {% for event in day.multiday %}
  34. {# {% set offset = event.offset.d * 100 / 7 %}#}
  35. {# {% set length = (event.length.d - event.offset.d) * 100 / 7 %}#}
  36. <div class="multiday" style="display: block;"><div class="inner">{{- event.label -}}</div></div>
  37. {% endfor %}
  38. {% endfor %}
  39. {% endfor %}
  40. </div>
  41. {# next allday events #}
  42. <div class="alldays">
  43. {% for weekcounter,row in rows %}
  44. {% for day in row.weekdays %}
  45. <div class="day">
  46. {# {{ row.date }}#}
  47. {% for event in day.allday %}
  48. <div class="allday"><div class="inner">{{- event.label -}}</div></div>
  49. {% endfor %}
  50. </div>
  51. {% endfor %}
  52. {% endfor %}
  53. </div>
  54. {# render other events based on time and duration #}
  55. <div class="otherdays">
  56. {% for weekcounter,row in rows %}
  57. {% for day in row.weekdays %}
  58. {% for hour,events in day.other %}
  59. <div class="time">
  60. {{ hour }}
  61. <div class="label">
  62. {% for event in events %}
  63. {# @TODO get line height from css? #}
  64. {% set height = event.length.h * 1.60 %}
  65. <div class="hour" style="height: {{ height }}rem; background-color: {{ event.color }};">{{- event.row -}}</div>
  66. {% endfor %}
  67. </div>
  68. </div>
  69. {% endfor %}
  70. {% endfor %}
  71. {% endfor %}
  72. </div>
  73. </div>
  74. </div>