Skip to content

Commit dfc545d

Browse files
authored
feat: site dropdown (#1046)
1 parent fd859db commit dfc545d

File tree

21 files changed

+1589
-1694
lines changed

21 files changed

+1589
-1694
lines changed

docs/configuration/settings.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ from django.utils.translation import gettext_lazy as _
1818
UNFOLD = {
1919
"SITE_TITLE": "Custom suffix in <title> tag",
2020
"SITE_HEADER": "Appears in sidebar at the top",
21+
"SITE_SUBHEADER": "Appears under SITE_HEADER",
22+
"SITE_DROPDOWN": [
23+
{
24+
"icon": "diamond",
25+
"title": _("My site"),
26+
"link": "https://example.com",
27+
},
28+
# ...
29+
],
2130
"SITE_URL": "/",
2231
# "SITE_ICON": lambda request: static("icon.svg"), # both modes, optimise for 32px height
2332
"SITE_ICON": {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Site dropdown
3+
order: 2
4+
description: Learn how to configure dropdown navigation in the sidebar when clicking on the site header in Django Unfold admin interface.
5+
---
6+
7+
# Site dropdown
8+
9+
Unfold provides a possibility to specify a dropdown navigation in sidebar when clicking on the site header by using `SITE_DROPDOWN` option in `UNFOLD` configuration dictionary. When this option is set, a dropdown icon will display on the site header to mark that site header is clickable.
10+
11+
```python
12+
# settings.py
13+
14+
from django.urls import reverse_lazy
15+
from django.utils.translation import gettext_lazy as _
16+
17+
18+
UNFOLD = {
19+
"SITE_DROPDOWN": [
20+
{
21+
"icon": "diamond",
22+
"title": _("My site"),
23+
"link": "https://example.com",
24+
},
25+
{
26+
"icon": "diamond",
27+
"title": _("My site"),
28+
"link": reverse_lazy("admin:index"),
29+
},
30+
]
31+
}
32+
```

docs/dashboard/index.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ TEMPLATES = [
3535
{% endblock %}
3636

3737
{% block branding %}
38-
<h1 id="site-name">
39-
<a href="{% url 'admin:index' %}">
40-
{{ site_header|default:_('Django administration') }}
41-
</a>
42-
</h1>
38+
{% include "unfold/helpers/site_branding.html" %}
4339
{% endblock %}
4440

4541
{% block content %}

0 commit comments

Comments
 (0)