added menu icons
This commit is contained in:
@@ -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 = []
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">{% for app in apps %}
|
||||
<li {% if app == active_app %} class="active" {%endif%}>
|
||||
<a href="/{{app.label}}/"><strong>{{ app.name|title }}</strong></a>
|
||||
<a href="/{{app.label}}/">{% bootstrap_icon app.menu_icon %} · <strong>{{ app.name|title }}</strong></a>
|
||||
</li>
|
||||
{% if app == active_app %}{% for t in app_menu %}{% include t %}{% endfor %}{% endif %}
|
||||
{%endfor%}
|
||||
|
||||
Reference in New Issue
Block a user