Skip to content

Commit ddd9a47

Browse files
committed
Add option to display label on sidebar
1 parent 536f9e9 commit ddd9a47

File tree

4 files changed

+64
-6
lines changed

4 files changed

+64
-6
lines changed

atlas/configuration/config.py.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ NOM_APPLICATION = "Nom de l application"
5151
# ex "/atlas" pour une URL: http://mon-domaine/atlas OU "" si l'application est accessible à la racine du domaine
5252
URL_APPLICATION = "/atlas"
5353

54+
# Afficher ou non les labels dans la barre latérale
55+
AFFICHAGE_LABEL_SIDEBAR = False
56+
5457
#################################
5558
#################################
5659
###### Modules activation #######

atlas/configuration/config_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class Meta:
174174
AFFICHAGE_EN_CE_MOMENT = fields.Boolean(load_default=True)
175175
AFFICHAGE_RANG_STAT = fields.Boolean(load_default=True)
176176
AFFICHAGE_NOUVELLES_ESPECES = fields.Boolean(load_default=True)
177+
AFFICHAGE_LABEL_SIDEBAR = fields.Boolean(load_default=False)
177178
AFFICHAGE_RECHERCHE_AVANCEE = fields.Boolean(load_default=False)
178179
AFFICHAGE_GRAPH_ALTITUDES = fields.Boolean(load_default=True)
179180
AFFICHAGE_GRAPH_PHENOLOGIE = fields.Boolean(load_default=True)

atlas/static/css/atlas.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ sidebar {
388388
#sidebar_menu li {
389389
height: 60px !important;
390390
min-height: 60px;
391-
line-height: 60px;
392391
color: white;
393392
cursor: pointer;
394393
text-align: center;

atlas/templates/core/sideBar.html

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,63 @@
1+
<style>
2+
{% if configuration.AFFICHAGE_LABEL_SIDEBAR %}
3+
@media (min-width: 768px) {
4+
#sidebar_menu {
5+
width: 100px;
6+
li {
7+
height: unset !important;
8+
9+
> a {
10+
padding: 1rem 0.5rem !important;
11+
}
12+
13+
.short_title {
14+
padding-top: 0.5rem;
15+
font-size: 0.8rem;
16+
font-weight: bold;
17+
text-transform: uppercase;
18+
}
19+
}
20+
}
21+
main {
22+
margin-left: 100px;
23+
}
24+
}
25+
@media (max-width: 768px) {
26+
#sidebar_menu {
27+
li {
28+
.short_title {
29+
display: none;
30+
}
31+
}
32+
}
33+
}
34+
{% else %}
35+
.sidebar-brand > a {
36+
justify-content: center;
37+
}
38+
{% endif %}
39+
</style>
40+
141
<ul id="sidebar_menu" class="sidebar-nav">
242

343
<li class="sidebar-brand">
444
<a href="{{ url_for('main.index') }}" id="menu-toggle"
5-
class="d-flex justify-content-center align-items-center p-3 w-100 h-100"
45+
class="d-flex align-items-center flex-column p-3 w-100 h-100"
646
data-bs-toggle="tooltip"
747
title="{{ _('back.to.home') }}"
848
data-bs-placement="right">
949
<span id="main_icon" class="fa fa-home"></span>
50+
{% if configuration.AFFICHAGE_LABEL_SIDEBAR %}
51+
<div class="short_title">{{ _("home") | upper }}</div>
52+
{% endif %}
1053
</a>
1154
</li>
1255

1356
{% for page_key, page_values in configuration.STATIC_PAGES.items()|sort(attribute='1.order') %}
1457
{% if 'url' in page_values %}
1558
<li class="sidebar-brand">
1659
<a href="{{ page_values.url }}" target="_blank"
17-
class="d-flex justify-content-center align-items-center p-3 w-100 h-100"
60+
class="d-flex align-items-center flex-column p-3 w-100 h-100"
1861
data-bs-toggle="tooltip"
1962
title="{{ page_values.title }}"
2063
data-bs-placement="right">
@@ -25,12 +68,15 @@
2568
{% else %}
2669
<span class="fas {{ page_values.picto }}"></span>
2770
{% endif %}
71+
{% if configuration.AFFICHAGE_LABEL_SIDEBAR and 'label' in page_values %}
72+
<div class="short_title">{{ page_values.short_title }}</div>
73+
{% endif %}
2874
</a>
2975
</li>
3076
{% else %}
3177
<li class="sidebar-brand">
3278
<a href="{{ url_for('main.get_staticpages', page=page_key) }}"
33-
class="d-flex justify-content-center align-items-center p-3 w-100 h-100"
79+
class="d-flex flex-column align-items-center p-3 w-100 h-100"
3480
data-bs-toggle="tooltip"
3581
title="{{ page_values.title }}"
3682
data-bs-placement="right">
@@ -41,29 +87,38 @@
4187
{% else %}
4288
<span class="fas {{ page_values.picto }}"></span>
4389
{% endif %}
90+
{% if configuration.AFFICHAGE_LABEL_SIDEBAR and 'short_title' in page_values %}
91+
<div class="short_title">{{ page_values.short_title }}</div>
92+
{% endif %}
4493
</a>
4594
</li>
4695
{% endif %}
4796
{% endfor %}
4897
{% if configuration.AFFICHAGE_RECHERCHE_AVANCEE %}
4998
<li class="sidebar-brand">
5099
<a href="{{ url_for('main.advanced_search') }}"
51-
class="d-flex justify-content-center align-items-center p-3 w-100 h-100"
100+
class="d-flex flex-column align-items-center p-3 w-100 h-100"
52101
data-bs-toggle="tooltip"
53102
title="{{ _('advanced_search') }}"
54103
data-bs-placement="right">
55104
<span class="fa fa-search"></span>
105+
{% if configuration.AFFICHAGE_LABEL_SIDEBAR %}
106+
<div class="short_title">{{ _("advanced_search") | upper }}</div>
107+
{% endif %}
56108
</a>
57109
</li>
58110
{% endif %}
59111

60112
<li class="sidebar-brand">
61113
<a href="{{ url_for('main.photos') }}"
62-
class="d-flex justify-content-center align-items-center p-3 w-100 h-100"
114+
class="d-flex flex-column align-items-center p-3 w-100 h-100"
63115
data-bs-toggle="tooltip"
64116
title="{{ _('gallery.title') }}"
65117
data-bs-placement="right">
66118
<span class="fa fa-camera"></span>
119+
{% if configuration.AFFICHAGE_LABEL_SIDEBAR %}
120+
<div class="short_title">{{ _("photos") | upper }}</div>
121+
{% endif %}
67122
</a>
68123
</li>
69124

0 commit comments

Comments
 (0)