-
Notifications
You must be signed in to change notification settings - Fork 11
Configuring the navbar
deby edited this page May 5, 2019
·
8 revisions
↑ Parent: Tutorials
← Previous: Single pages
You might not want all your links to pages and collections to be on the nav bar itself, but in dropdown lists instead.
To achieve that, you may specify a navbar_link_list
in your page or collection settings. It's a string that corresponds to the name of a list.
By default, your website will already contain 2 lists: you
and more
.
You may add more lists in your settings:
from magi.default_settings import DEFAULT_ENABLED_NAVBAR_LISTS
ENABLED_NAVBAR_LISTS = DEFAULT_ENABLED_NAVBAR_LISTS
ENABLED_NAVBAR_LISTS['stuff'] = { ... }
The settings of a navbar list may contain:
Key | Value | Default | Example |
---|---|---|---|
icon | String name of a flaticon that illustrates the nav bar list | None | 'fingers' |
image | Path to image that illustrates the nav bar list | None | 'stuff.png' |
title | Localized name of the list or function that takes the context and return a string | required | |
headers | A list of (header name, dict { icon or image , title , small (default = True )) which will be displayed as headers within the dropdown list |
None | 'headers': [ ('social-header', { 'icon': 'settings', 'title': 'Social stuff', }) ] |
order | The list of link names and header names in the order you'd like to see them under the navbar. For collections, the name will generally be name_list (example: activity_list ) |
None (order not guaranteed) | ['activity_list', 'account_list', 'donate_list', 'social-header', 'discord', 'twitter'] |
Example of a dropdown list, ordered, with a divider, and a header:
→ Next: References
I. Introduction
II. Tutorials
III. References
- Files tree
- Default collections
- Default pages
- Website settings
- MagiCollection settings
- Abstract models
- Abstract collections
- MagiForm settings
- MagiFiltersForm settings
- Single pages settings
IV. Utils
-
MagiModel utils
- MagiModel images and files
- DateTime fields
- BaseAccount model
- Save choices values as integer rather than strings
- Store comma separated values
- Store dictionaries
- Store Markdown texts
- Translate fields values in multiple languages
- Store JSON
- More model field types
- Transform images before saving them
- Check choices at form level instead of model level
- Use an internal cache for foreign keys in models
- Customize views with MagiModel properties
- Events
- Form utils
- Python utils
- Templates utils
- Javascript utils
- Enable and disable existing collections and pages
- Translations
- Page titles and descriptions
- Characters
- Seasons
- Roles and permissions
- Allow your staff team to change configurations
- Custom users preferences and settings
- Background illustrations
- Activities tabs
- Corner popups
VI. More