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: village_sidemenu

Usage: {% village_sidemenu data_dict %}

Exemples

Données

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

Résultat