added menu icons
This commit is contained in:
@@ -5,6 +5,6 @@ class Config(AppConfig):
|
|||||||
name = 'maraudes'
|
name = 'maraudes'
|
||||||
|
|
||||||
index_url = "/maraudes/"
|
index_url = "/maraudes/"
|
||||||
|
menu_icon = "road"
|
||||||
def get_index_url(self):
|
def get_index_url(self):
|
||||||
return "/maraudes/"
|
return "/maraudes/"
|
||||||
|
|||||||
@@ -7,12 +7,17 @@ from django.template import Template, Context
|
|||||||
from django.views.generic.base import ContextMixin, TemplateResponseMixin
|
from django.views.generic.base import ContextMixin, TemplateResponseMixin
|
||||||
|
|
||||||
## Utils ##
|
## Utils ##
|
||||||
def get_apps(app_names):
|
APP_ICONS = {
|
||||||
|
'maraudes': 'road',
|
||||||
|
'suivi': 'eye-open',
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_apps_config(app_names):
|
||||||
_apps = []
|
_apps = []
|
||||||
for name in app_names:
|
for name in app_names:
|
||||||
_apps.append(
|
app_config = apps.get_app_config(name)
|
||||||
apps.get_app_config(name)
|
app_config.menu_icon = APP_ICONS[name]
|
||||||
)
|
_apps.append(app_config)
|
||||||
return _apps
|
return _apps
|
||||||
|
|
||||||
## Mixins ##
|
## Mixins ##
|
||||||
@@ -58,9 +63,10 @@ class WebsiteTemplateMixin(TemplateResponseMixin):
|
|||||||
class Configuration:
|
class Configuration:
|
||||||
stylesheets = ['base.css']
|
stylesheets = ['base.css']
|
||||||
navbar_apps = ['maraudes', 'suivi']
|
navbar_apps = ['maraudes', 'suivi']
|
||||||
apps = get_apps(navbar_apps)
|
apps = get_apps_config(navbar_apps)
|
||||||
page_blocks = ['header', 'header_small', 'title']
|
page_blocks = ['header', 'header_small', 'title']
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._page_blocks = []
|
self._page_blocks = []
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<div class="collapse navbar-collapse">
|
<div class="collapse navbar-collapse">
|
||||||
<ul class="nav navbar-nav">{% for app in apps %}
|
<ul class="nav navbar-nav">{% for app in apps %}
|
||||||
<li {% if app == active_app %} class="active" {%endif%}>
|
<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>
|
</li>
|
||||||
{% if app == active_app %}{% for t in app_menu %}{% include t %}{% endfor %}{% endif %}
|
{% if app == active_app %}{% for t in app_menu %}{% include t %}{% endfor %}{% endif %}
|
||||||
{%endfor%}
|
{%endfor%}
|
||||||
|
|||||||
Reference in New Issue
Block a user