From 219b68302e93aeee69bff20d2a41d5927449f1ac Mon Sep 17 00:00:00 2001 From: Arthur Gerbaud Date: Sun, 14 Aug 2016 01:11:11 +0200 Subject: [PATCH] added menu icons --- maraudes/apps.py | 2 +- website/mixins.py | 16 +++++++++++----- website/templates/navbar.html | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/maraudes/apps.py b/maraudes/apps.py index 89fbcde..52cb84c 100644 --- a/maraudes/apps.py +++ b/maraudes/apps.py @@ -5,6 +5,6 @@ class Config(AppConfig): name = 'maraudes' index_url = "/maraudes/" - + menu_icon = "road" def get_index_url(self): return "/maraudes/" diff --git a/website/mixins.py b/website/mixins.py index 0080ecc..d20d5b6 100644 --- a/website/mixins.py +++ b/website/mixins.py @@ -7,12 +7,17 @@ from django.template import Template, Context from django.views.generic.base import ContextMixin, TemplateResponseMixin ## Utils ## -def get_apps(app_names): +APP_ICONS = { + 'maraudes': 'road', + 'suivi': 'eye-open', +} + +def get_apps_config(app_names): _apps = [] for name in app_names: - _apps.append( - apps.get_app_config(name) - ) + app_config = apps.get_app_config(name) + app_config.menu_icon = APP_ICONS[name] + _apps.append(app_config) return _apps ## Mixins ## @@ -58,9 +63,10 @@ class WebsiteTemplateMixin(TemplateResponseMixin): class Configuration: stylesheets = ['base.css'] navbar_apps = ['maraudes', 'suivi'] - apps = get_apps(navbar_apps) + apps = get_apps_config(navbar_apps) page_blocks = ['header', 'header_small', 'title'] + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._page_blocks = [] diff --git a/website/templates/navbar.html b/website/templates/navbar.html index 85ec5e6..9be3572 100644 --- a/website/templates/navbar.html +++ b/website/templates/navbar.html @@ -13,7 +13,7 @@