BS5 Theme

This commit is contained in:
Aaron Kable
2023-10-07 08:20:22 +00:00
committed by Ariel Rin
parent 567d97f38a
commit 2e78aa5f26
161 changed files with 3198 additions and 1655 deletions

View File

@@ -4,37 +4,21 @@ The menu hooks allow you to dynamically specify menu items from your plugin app
To register a MenuItemHook class you would do the following:
```Python
```python
@hooks.register('menu_item_hook')
def register_menu():
return MenuItemHook('Example Item', 'glyphicon glyphicon-heart', 'example_url_name',150)
return MenuItemHook('Example Item', 'fas fa-user fa-fw"', 'example_url_name', 150)
```
The `MenuItemHook` class specifies some parameters/instance variables required for menu item display.
## MenuItemHook(text, classes, url_name, order=None)
```eval_rst
.. autoclass:: allianceauth.services.hooks.MenuItemHook
:members: __init__
:undoc-members:
```
### text
The text shown as menu item, e.g. usually the name of the app.
### classes
The classes that should be applied to the bootstrap menu item icon
### url_name
The name of the Django URL to use
### order
An integer which specifies the order of the menu item, lowest to highest. Community apps are free ot use an oder above `1000`. Numbers below are served for Auth.
### navactive
A list of views or namespaces the link should be highlighted on. See [django-navhelper](https://github.com/geelweb/django-navhelper#navactive) for usage. Defaults to the supplied `url_name`.
### count
## count
`count` is an integer shown next to the menu item as badge when `count` is not `None`.
@@ -49,10 +33,18 @@ This is a great feature to signal the user, that he has some open issues to take
To use it set count the `render()` function of your subclass in accordance to the current user. Here is an example:
```eval_rst
.. automodule:: allianceauth.services.hooks.MenuItemHook
:members: render
:noindex:
:undoc-members:
```
```Python
def render(self, request):
# ...
self.count = calculate_count_for_user(request.user)
return MenuItemHook.render(self, request)
# ...
```