From e3cc515fed613f963f1d0bf180571a7b4bb63919 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Wed, 6 Sep 2023 18:13:06 +0200
Subject: [PATCH] Fix calendar page content

---
 district/templates/district/base.html              |  2 +-
 .../templates/district/district_calendar_page.html |  6 +++---
 .../templates/district/district_home_page.html     |  2 +-
 .../shared/calendar_current_events_snippet.html    | 14 +++++++-------
 uniweb/templates/uniweb/uniweb_calendar_page.html  |  6 +++---
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/district/templates/district/base.html b/district/templates/district/base.html
index 60c14b52..572efba3 100644
--- a/district/templates/district/base.html
+++ b/district/templates/district/base.html
@@ -221,7 +221,7 @@
           </div>
           <div class="subnav-aside__item" :class="{'subnav-aside__item--visible': isCurrentView('calendar')}">
             <div class="container container--default">
-              {% include "shared/calendar_current_events_snippet.html" %}
+              {% include "shared/calendar_current_events_snippet.html" with calendar=page.root_page.calendar %}
             </div>
           </div>
         </aside>
diff --git a/district/templates/district/district_calendar_page.html b/district/templates/district/district_calendar_page.html
index 22af18e4..ea4930b2 100644
--- a/district/templates/district/district_calendar_page.html
+++ b/district/templates/district/district_calendar_page.html
@@ -3,8 +3,8 @@
 
 {% block content %}
 <main>
-    <section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
-        {% include "shared/calendar_current_events_snippet.html" with fullscreen=True %}
-    </section>
+  <section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
+    {% include "shared/calendar_current_events_snippet.html" with fullscreen=True calendar=page.calendar %}
+  </section>
 </main>
 {% endblock %}
diff --git a/district/templates/district/district_home_page.html b/district/templates/district/district_home_page.html
index bfe82049..9f2d901b 100644
--- a/district/templates/district/district_home_page.html
+++ b/district/templates/district/district_home_page.html
@@ -43,7 +43,7 @@
 
   {% if page.show_calendar_on_hp %}
     <section class="my-8 lg:my-24 container-padding--zero lg:container-padding--auto">
-      {% include "shared/calendar_current_events_snippet.html" %}
+      {% include "shared/calendar_current_events_snippet.html" with calendar=page.calendar %}
     </section>
   {% endif %}
 
diff --git a/shared/templates/shared/calendar_current_events_snippet.html b/shared/templates/shared/calendar_current_events_snippet.html
index 933b0615..3a410a6e 100644
--- a/shared/templates/shared/calendar_current_events_snippet.html
+++ b/shared/templates/shared/calendar_current_events_snippet.html
@@ -1,23 +1,23 @@
 {% load event_list %}
-{% if page.root_page.has_calendar %}
+{% if calendar %}
   <div class="calendar grid grid-cols-4">
     <div class="col-span-4 xl:col-span-1">
       <aside class="banner bg-orange-300 text-white h-full">
         <i class="ico--calendar banner__icon"></i>
         <div class="banner__body"><h1 class="head-alt-md banner__cta">Kalendář</h1>
           {% if not fullscreen and page.calendar_page %}
-          <a href="{{ page.calendar_page.url }}">
-            <button class="btn btn--white btn--fullwidth sm:btn--autowidth mt-8">
-              <div class="btn__body">Zobrazit další</div>
-            </button>
-          </a>
+            <a href="{{ page.calendar_page.url }}">
+              <button class="btn btn--white btn--fullwidth sm:btn--autowidth mt-8">
+                <div class="btn__body">Zobrazit další</div>
+              </button>
+            </a>
           {% endif %}
         </div>
       </aside>
     </div>
     <div class="col-span-4 xl:col-span-3">
       {% with full_list=fullscreen %}
-      {% with events=page.root_page.calendar|event_list:full_list %}
+      {% with events=calendar|event_list:full_list %}
       {% for event in events %}
         <div class="grid grid-cols-12 items-center calendar-table-row">
           <div class="col-span-2 text-orange-300 head-alt-md calendar-table-row__col">
diff --git a/uniweb/templates/uniweb/uniweb_calendar_page.html b/uniweb/templates/uniweb/uniweb_calendar_page.html
index 6825c028..cd393c8a 100644
--- a/uniweb/templates/uniweb/uniweb_calendar_page.html
+++ b/uniweb/templates/uniweb/uniweb_calendar_page.html
@@ -3,8 +3,8 @@
 
 {% block content %}
 <main>
-    <section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
-        {% include "shared/calendar_current_events_snippet.html" with fullscreen=True %}
-    </section>
+  <section class="my-8 lg:my-16 container-padding--zero lg:container-padding--auto">
+    {% include "shared/calendar_current_events_snippet.html" with fullscreen=True calendar=page.calendar %}
+  </section>
 </main>
 {% endblock %}
-- 
GitLab