Menu latéral

Documentation du tag

Returns a side menu item. Takes a dict as parameter, with the following structure:

data_dict = {
    "items": "a list of similarly structured dictionaries (see below)",
    "title": "(Optional) The title of the main menu",
    "heading_tag": "(Optional) Heading tag for the accordion title (h2, etc. Default: div)"
    "extra_classes": "(Optional) string with names of extra classes",
}

Item-level-dictionaries items can have either links or a sub-level menu list, and it can accept three levels of nested menu entries.

item_dict = {
    "label": "The label of the menu item",
    "items": "(EITHER) a list of similarly structured dictionaries (see below)",
    "link": "(OR) the link (fragment) of the menu item",
}

All of the keys of the dict can be passed directly as named parameters of the tag.

Tag name: dsfr_sidemenu

Usage: {% dsfr_sidemenu data_dict %}

Exemples

Exemple 1

{'items': [{'items': [{'label': 'Une page', 'link': '#'},
                      {'label': 'Une autre page', 'link': '/sidemenu'}],
            'label': 'Menu replié'},
           {'items': [{'items': [{'label': 'Encore une page', 'link': '#'}],
                       'label': 'Sous-menu replié'},
                      {'items': [{'label': 'Page non active', 'link': '#'},
                                 {'label': 'Page active',
                                  'link': '/django-dsfr/components/sidemenu/'}],
                       'label': 'Sous-menu ouvert'}],
            'label': 'Menu ouvert'}],
 'title': 'Menu'}