make navbar template more readable
This commit is contained in:
parent
a783fde208
commit
e3196c7ad5
3 changed files with 59 additions and 65 deletions
24
databags/nav-bar.ini
Normal file
24
databags/nav-bar.ini
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
[NavBar]
|
||||||
|
Blog = '/blog'
|
||||||
|
Rezept = '/rezept'
|
||||||
|
mitglied = '/mitmachen'
|
||||||
|
Kontakt = '/kontakt'
|
||||||
|
|
||||||
|
|
||||||
|
[Rezept]
|
||||||
|
show_projekt = '/rezept/'
|
||||||
|
xml = '/feed_projekte.xml'
|
||||||
|
|
||||||
|
|
||||||
|
[Kontakt]
|
||||||
|
Kontakt = '/kontakt'
|
||||||
|
Impressum = '/impressum'
|
||||||
|
Datenschutz = '/datenschutz'
|
||||||
|
|
||||||
|
[Blog]
|
||||||
|
Alle-Beitraege = '/blog/'
|
||||||
|
RSS-Feed = '/feed_blog.xml'
|
||||||
|
|
||||||
|
[list]
|
||||||
|
Rezept = '/rezept/'
|
||||||
|
Blog = '/blog/'
|
|
@ -7,7 +7,7 @@ Rezept = Rezepte
|
||||||
Kontakt = Kontakt
|
Kontakt = Kontakt
|
||||||
Impressum = Impressum
|
Impressum = Impressum
|
||||||
Datenschutz = Datenschutz
|
Datenschutz = Datenschutz
|
||||||
xml = als XML-Feed
|
xml = Rezepte als XML-Feed
|
||||||
mitglied = Werde Teil der Waffel Crew
|
mitglied = Werde Teil der Waffel Crew
|
||||||
Anfahrt = Anfahrt
|
Anfahrt = Anfahrt
|
||||||
fragen = Häufige Fragen
|
fragen = Häufige Fragen
|
||||||
|
@ -18,6 +18,8 @@ Englisch = English
|
||||||
falls = if available
|
falls = if available
|
||||||
show_projekt = Alle Rezepte
|
show_projekt = Alle Rezepte
|
||||||
default_path = 'en'
|
default_path = 'en'
|
||||||
|
RSS-Feed = RSS Feed
|
||||||
|
Alle-Beitraege = Alle Beiträge
|
||||||
|
|
||||||
[en]
|
[en]
|
||||||
home = Start
|
home = Start
|
||||||
|
@ -26,7 +28,7 @@ Rezept = Recipes
|
||||||
Kontakt = Contact
|
Kontakt = Contact
|
||||||
Impressum = Imprint
|
Impressum = Imprint
|
||||||
Datenschutz = Data protection
|
Datenschutz = Data protection
|
||||||
xml = as XML feed
|
xml = Recipes as XML feed
|
||||||
mitglied = become part of our waffle crew
|
mitglied = become part of our waffle crew
|
||||||
Anfahrt = Approach
|
Anfahrt = Approach
|
||||||
fragen = Frequently Asked Questions
|
fragen = Frequently Asked Questions
|
||||||
|
@ -37,4 +39,5 @@ English = English
|
||||||
falls = if available
|
falls = if available
|
||||||
show_projekt = All recipes
|
show_projekt = All recipes
|
||||||
default_path = ''
|
default_path = ''
|
||||||
|
RSS-Feed = RSS Feed
|
||||||
|
Alle-Beitraege = all news
|
||||||
|
|
|
@ -109,67 +109,34 @@
|
||||||
%}><a href="{{ '/'|url }}">{%
|
%}><a href="{{ '/'|url }}">{%
|
||||||
if bag('navigation', this.alt, 'home') %}{{ bag('navigation', this.alt, 'home') }}{%
|
if bag('navigation', this.alt, 'home') %}{{ bag('navigation', this.alt, 'home') }}{%
|
||||||
else %}{{ bag('navigation', 'de', 'home') }}{% endif %}</a></li>{%
|
else %}{{ bag('navigation', 'de', 'home') }}{% endif %}</a></li>{%
|
||||||
for href, title, print in [
|
for title, href in bag('nav-bar', "NavBar").items() %}
|
||||||
['/blog', 'Blog', 1],
|
|
||||||
['/rezept', 'Rezept', 1],
|
|
||||||
['/mitmachen', 'mitglied', 1],
|
|
||||||
['/hunger', 'Wo gibt es Waffeln?', 0],
|
|
||||||
['/kontakt', 'Kontakt', 1]
|
|
||||||
] %}{% if print %}
|
|
||||||
<li{% if this.is_child_of(href) %} class="active"{% endif
|
<li{% if this.is_child_of(href) %} class="active"{% endif
|
||||||
%}><a href="{{ href|url }}">{%
|
%}><a href="{{ href|url }}">{% if bag('navigation', this.alt, title) %}{{ bag('navigation', this.alt, title) }}{% else %}{{ title }}{% endif %}</a>
|
||||||
if bag('navigation', this.alt, title)
|
<ul>
|
||||||
%}{{ bag('navigation', this.alt, title) }}{%
|
{% if bag('nav-bar', 'list', title) %}
|
||||||
else %}{{ title }}{%
|
{% set root = site.get( bag('nav-bar', 'list', title), alt=this.alt) %}{%
|
||||||
endif %}</a>{#
|
for child in root.children recursive %}{% if loop.index <= 7 %}
|
||||||
|
<li{% if this._path == child._path %} class="active"{% endif %}>
|
||||||
Hier beginnt die vorhin erwähnt if-schleife,
|
<a href="{{ child|url }}">
|
||||||
in der die Untermenüs definiert werden.
|
{{ child.shorttitle if child.shorttitle else child.title }}
|
||||||
|
</a></li>
|
||||||
PLZ Fix me!!!
|
{% endif %}{% endfor %}
|
||||||
|
{% endif %}
|
||||||
-> Eine Idee zum Fix wäre, die obige Tabelle ausweiten...
|
{% if bag('nav-bar', title) %}
|
||||||
|
{% for nav_title, nav_url in bag('nav-bar', title).items() %}
|
||||||
#}{%
|
<li><a href={{ nav_url if 'http' in nav_url else nav_url|url }}
|
||||||
if title == 'Rezept' %}
|
{% if bag('nav-bar', 'button', nav_title) %}
|
||||||
<ul>{% set root = site.get('/rezept/', alt=this.alt) %}{%
|
class="button special"
|
||||||
for child in root.children recursive %}{% if loop.index <= 8 %}
|
{% endif %}>
|
||||||
<li{%
|
{{ bag('navigation', this.alt, nav_title)
|
||||||
if this._path == child._path %} class="active"{% endif
|
if bag('navigation', this.alt, nav_title)
|
||||||
%}><a href="{% if this.alt == 'de' %}{% else %}/{{ this.alt }}/{% endif %}{{ child|url }}">{{ child.title }}</a></li>{%
|
else bag('navigation', 'de', nav_title) }}
|
||||||
endif %}{% endfor %}
|
</a></li>
|
||||||
<li><a href="{{ '/rezept/'|url }}">{%
|
{% endfor %}
|
||||||
if bag('navigation', this.alt, 'show_projekt') %}{{ bag('navigation', this.alt, 'show_projekt') }}{%
|
{% endif %}
|
||||||
else %}{{ bag('navigation', 'de', 'show_projekt') }}{% endif %}</a></li>
|
</ul>
|
||||||
<li><a href="{{ '/feed_projekte.xml'|url }}">{%
|
</li>
|
||||||
if bag('navigation', this.alt, title) %}{{ bag('navigation', this.alt, title) }}{%
|
{% endfor %}
|
||||||
else %}{{ title }}{% endif %} {%
|
|
||||||
if bag('navigation', this.alt, 'xml') %}{{ bag('navigation', this.alt, 'xml') }}{%
|
|
||||||
else %}{{ bag('navigation', 'de', 'xml') }}{% endif %}</a></li>
|
|
||||||
</ul>{%
|
|
||||||
elif title == 'Kontakt' %}
|
|
||||||
<ul><li><a href="{{ '/kontakt'|url }}">{%
|
|
||||||
if bag('navigation', this.alt, 'Kontakt') %}{{ bag('navigation', this.alt, 'Kontakt') }}{%
|
|
||||||
else %}{{ bag('navigation', 'de', 'Kontakt') }}{% endif %}</a></li>
|
|
||||||
<li><a href="{{ '/impressum'|url }}">{%
|
|
||||||
if bag('navigation', this.alt, 'Impressum') %}{{ bag('navigation', this.alt, 'Impressum') }}{%
|
|
||||||
else %}Impressum{% endif %}</a></li>
|
|
||||||
<li><a href="{{ '/datenschutz/'|url }}">{%
|
|
||||||
if bag('navigation', this.alt, 'Datenschutz') %}{{ bag('navigation', this.alt, 'Datenschutz') }}{%
|
|
||||||
else %}Datenschutz{% endif %}</a></li>
|
|
||||||
</ul>{%
|
|
||||||
elif title == 'Blog' %}
|
|
||||||
<ul>{% set root = site.get('/blog/', alt=this.alt) %}{%
|
|
||||||
for child in root.children recursive %}{% if loop.index <= 8 %}
|
|
||||||
<li{%
|
|
||||||
if this._path == child._path %} class="active"{% endif
|
|
||||||
%}><a href="{{ child|url }}">{{ child.shorttitle }}</a></li>{%
|
|
||||||
endif %}{% endfor %}
|
|
||||||
<li><a href="{{ '/blog/'|url }}">Alle Beiträge</a></li>
|
|
||||||
<li><a href="{{ '/feed_blog.xml'|url }}">RSS Feed</a></li></ul>{%
|
|
||||||
endif %}</li>{%
|
|
||||||
endif %}{%
|
|
||||||
endfor %}
|
|
||||||
<li class="last"><a href="/{% if bag('navigation', this.alt, 'default_path') %}{{ bag('navigation', this.alt, 'default_path') }}{% else %}..{% endif %}{{ this._path }}">{% if bag('navigation', this.alt, 'sprache') %}{{ bag('navigation', this.alt, 'sprache') }}{% else %}Sprache{% endif %}</a>
|
<li class="last"><a href="/{% if bag('navigation', this.alt, 'default_path') %}{{ bag('navigation', this.alt, 'default_path') }}{% else %}..{% endif %}{{ this._path }}">{% if bag('navigation', this.alt, 'sprache') %}{{ bag('navigation', this.alt, 'sprache') }}{% else %}Sprache{% endif %}</a>
|
||||||
<ul class="last">
|
<ul class="last">
|
||||||
<li><a href="{{ this._path }}">{%
|
<li><a href="{{ this._path }}">{%
|
||||||
|
|
Loading…
Reference in a new issue