Skip to content

Commit da2cdf4

Browse files
committed
fix(home): 🐛 Fix Show descendants in bottom menu
1 parent 9d37ace commit da2cdf4

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

home/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def get_context(self, request):
181181
context = super().get_context(request)
182182
segments = SegmentPage.objects.child_of(self).live().order_by("order")
183183
context["segments"] = segments # sorted (segments, key=lambda x: x.order)
184+
context["exist_descendants"] = [descendant for descendant in self.get_descendants() if descendant.live and descendant.content_type == self.content_type]
184185
return context
185186

186187

home/templates/home/home_page.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,11 @@ <h2 class="subscribe-title" style="color: var(--footer-text);">{{page.footer_tit
237237
<img src="{{ tmp_logo.url }}" alt="{{ tmp_logo.alt }}">
238238
</div>
239239
<div class ="mb-5 row justify-content-center">
240+
{% if exist_descendants %}
240241
<div class="past-events text-start mb-3">
241242
<div class="subscribe-inner" style="padding: 16px;">
242243
<h2 class="subscribe-title" style="color: var(--footer-text); margin-bottom:10px;">Eventos pasados</h2>
243244
</div>
244-
{% for sibling in page.get_siblings %}
245-
{% if sibling.title and sibling.live and sibling.get_parent.content_type == page.content_type %}
246-
<a class="nav-link" href="{{ sibling.get_url }}"
247-
target="_blank" style="color: {{ page.navbar_links_color }} !important;">
248-
{{ sibling.title }}
249-
</a>
250-
{% endif %}
251-
{% endfor %}
252245
{% for descendant in page.get_descendants %}
253246
{% if descendant.live and descendant.content_type == page.content_type %}
254247
<a class="nav-link" href="{{ descendant.get_url }}"
@@ -258,6 +251,7 @@ <h2 class="subscribe-title" style="color: var(--footer-text); margin-bottom:10px
258251
{% endif %}
259252
{% endfor %}
260253
</div>
254+
{% endif %}
261255
</div>
262256
<div class="social-icons-footer">
263257
<ul>

0 commit comments

Comments
 (0)