You are here

calendar-month.html.twig in Calendar 8.2

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

Template to display a view as a calendar month.

Available variables:

  • rows: An array of data for each day of the week.

File

templates/calendar-month.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 for each day of the week.
  8. *
  9. * @ingroup themeable
  10. */
  11. #}
  12. {{ attach_library('calendar/calendar') }}
  13. <div class="calendar month">
  14. {% for row in rows %}
  15. {% if loop.first %}
  16. {% set dayheader = TRUE %}
  17. {% else %}
  18. {% set dayheader = FALSE %}
  19. {% endif %}
  20. <div class="data">
  21. <div class="weekno">
  22. {% if row.linkdata.show_week %}
  23. {% if row.linkdata.week_route %}
  24. <a href="{{ path(row.linkdata.week_route, {'arg_0': row.linkdata.year ~ row.linkdata.week }) }}">{{ row.linkdata.week }}</a>
  25. {% else %}
  26. {{ row.linkdata.week }}
  27. {% endif %}
  28. {% endif %}
  29. </div>
  30. <div class="headings">
  31. {% for key,value in row.weekdays %}
  32. <div class="day {{ key }} {{ value.class }}">
  33. {% if dayheader %}
  34. <div class="header">{{ value.header }}</div>
  35. {% endif %}
  36. {% if row.linkdata.day_route %}
  37. <div class="date"><a href="{{ path(row.linkdata.day_route, {'arg_0': row.linkdata.year ~ row.linkdata.month ~ value.date }) }}">{{ value.date }}</a></div>
  38. {% else %}
  39. {{ value.date }}
  40. {% endif %}
  41. </div>
  42. {% endfor %}
  43. </div>
  44. <div class="multidays">
  45. {% for day in row.weekdays %}
  46. {% for event in day.multiday %}
  47. {# {% if event.offset.h > 0 %}#}
  48. {# {% set offset = (event.offset.d + 1) * 100 / 7 %}#}
  49. {# {% else %}#}
  50. {% set offset = event.offset.d * 100 / 7 %}
  51. {# {% endif %}#}
  52. {% if event.length.h > 0 %}
  53. {% set length = (event.length.d + 1) * 100 / 7 %}
  54. {% else %}
  55. {% set length = event.length.d * 100 / 7 %}
  56. {% endif %}
  57. {% if length is same as(0) %}
  58. <div class="multiday" style="margin-left: {{ offset }}%; width: auto;"><div class="inner">{{- event.label -}}</div></div>
  59. {% else %}
  60. <div class="multiday" style="margin-left: {{ offset }}%; width: {{ length }}%;"><div class="inner">{{- event.label -}}</div></div>
  61. {% endif %}
  62. {% endfor %}
  63. {% endfor %}
  64. </div>
  65. <div class="otherdays">
  66. {% for key,value in row.weekdays %}
  67. <div class="day {{ key }} {{ value.class }}">
  68. <div class="alldays">
  69. {% for event in value.allday %}
  70. {% set offset = event.offset.d * 100 / 7 %}
  71. <div class ="allday">
  72. <div class="inner">
  73. {{- event.label -}}
  74. </div>
  75. </div>
  76. {% endfor %}
  77. </div>
  78. <div class="events">
  79. {% for event in value.other %}
  80. <div class="hour">
  81. <div class="inner" style="background-color: {{ event.color }}">{{- event.row -}}</div>
  82. </div>
  83. {% endfor %}
  84. </div>
  85. </div>
  86. {% endfor %}
  87. </div>
  88. </div>
  89. {% endfor %}
  90. </div>