Commit d447ba33 authored by fred's avatar fred

rewrite main nav active section highlighting

parent 7164ad74
......@@ -134,23 +134,30 @@ def metanav(context):
except KeyError:
# a context without 'requests' may happen when rendering error pages
request_path = 'xxx'
section = 'About'
paths = {
'/actus/': 'News',
'/sons/': 'Listen',
'/podcasts/': 'Listen',
'/topiks/': 'Topiks',
'/emissions': 'Emissions',
'/grille': 'Emissions',
'/programme/': 'Emissions',
'/recherche/': 'Search',
'/la-radio/': 'About',
}
section = ''
if request_path == '/':
section = 'Home'
elif request_path.startswith('/actus/'):
section = 'News'
elif request_path.startswith('/sons/'):
section = 'Listen'
elif request_path.startswith('/topiks'):
section = 'Topiks'
elif request_path.startswith('/emissions') or request_path == '/grille' or request_path == '/programme/':
section = 'Emissions'
elif request_path == '/recherche/':
section = 'Search'
else:
for path, section_name in paths.items():
if request_path.startswith(path):
section = section_name
break
return {
'LANGUAGE_CODE': context.get('LANGUAGE_CODE'),
'sectionName': section,
}
}
@register.inclusion_tag('includes/week.html')
def weekview(year=None, week=None):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment