forked from TagesschuleElementa/www.tagesschule-elementa.ch
navigation fixes
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
from cms.models import Page
|
||||
from haystack.forms import ModelSearchForm
|
||||
|
||||
|
||||
def search_form(request):
|
||||
return {'search_form': ModelSearchForm}
|
||||
|
||||
|
||||
def new_page_amount(request):
|
||||
tracked_pages = ['news', 'calendar']
|
||||
context = {}
|
||||
|
||||
for tracked_page in tracked_pages:
|
||||
try:
|
||||
page = Page.objects.public().get(reverse_id=tracked_page)
|
||||
id = 'new_{}_amount'.format(tracked_page)
|
||||
context.update({
|
||||
id: page.get_child_pages().count()
|
||||
})
|
||||
except Page.DoesNotExist:
|
||||
pass
|
||||
|
||||
return context
|
||||
|
||||
@@ -3,28 +3,32 @@
|
||||
<div class="navigation__main">
|
||||
{% for n in 'nn' %}
|
||||
<div class="{% cycle 'navigation__images' 'navigation__list' %}">
|
||||
{% for child in children %}
|
||||
{% thumbnail child.id|page_image 800x800 crop=True as thumb %}
|
||||
<div class="navigation__item data_id_{{ forloop.counter0 }}"
|
||||
{% if forloop.parentloop.first %}style="background-image: url('{{ thumb.url }}');"{% endif %}>
|
||||
<a href="#" class="navigation__item__title"
|
||||
data-id="{{ forloop.counter0 }}">
|
||||
<span>
|
||||
{% include 'project/assets/arrow-left.svg' %}
|
||||
{{ child.get_menu_title }}
|
||||
</span>
|
||||
</a>
|
||||
{% if child.children %}
|
||||
<ul class="navigation__item__list">
|
||||
{% for grandchild in child.children %}
|
||||
<li class="{% if grandchild.selected %}selected{% endif %}">
|
||||
<a href="{{ grandchild.attr.redirect_url|default:grandchild.get_absolute_url }}">
|
||||
{% include 'project/assets/arrow-right.svg' %}
|
||||
{{ grandchild.get_menu_title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% for child in children|slice:'3' %}
|
||||
{% thumbnail child.id|page_image 800x1200 crop=True as thumb %}
|
||||
<div class="navigation__item data_id_{{ forloop.counter0 }}" data-id="{{ forloop.counter0 }}">
|
||||
{% if forloop.parentloop.first %}
|
||||
<div class="navigation__item__background"
|
||||
style="background-image: url('{{ thumb.url }}');"></div>
|
||||
{% else %}
|
||||
<a href="#" class="navigation__item__title"
|
||||
data-id="{{ forloop.counter0 }}">
|
||||
<span>
|
||||
{% include 'project/assets/arrow-left.svg' %}
|
||||
{{ child.get_menu_title }}
|
||||
</span>
|
||||
</a>
|
||||
{% if child.children %}
|
||||
<ul class="navigation__item__list">
|
||||
{% for grandchild in child.children %}
|
||||
<li class="{% if grandchild.selected %}selected{% endif %}">
|
||||
<a href="{{ grandchild.attr.redirect_url|default:grandchild.get_absolute_url }}">
|
||||
{% include 'project/assets/arrow-right.svg' %}
|
||||
{{ grandchild.get_menu_title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
{% if news_url %}
|
||||
<a href="{{ news_url }}" class="header__button header__button--reverse header__button--light data_id_1">
|
||||
<span class="header__button__icon">
|
||||
{% if new_news_amount %}
|
||||
<span class="header__button__icon__number">{{ new_news_amount }}</span>
|
||||
{% endif %}
|
||||
{% include 'project/assets/news.svg' %}
|
||||
</span>
|
||||
{% trans 'News' %}
|
||||
@@ -23,6 +26,9 @@
|
||||
{% if calendar_url %}
|
||||
<a href="{{ calendar_url }}" class="header__button header__button--reverse header__button--light data_id_2">
|
||||
<span class="header__button__icon">
|
||||
{% if new_calendar_amount %}
|
||||
<span class="header__button__icon__number">{{ new_calendar_amount }}</span>
|
||||
{% endif %}
|
||||
{% include 'project/assets/calendar.svg' %}
|
||||
</span>
|
||||
{% trans 'Kalender' %}
|
||||
|
||||
Reference in New Issue
Block a user