mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-12-19 23:35:04 +01:00
Merge branch 'master' of gitlab.com:allianceauth/allianceauth into v4.x
This commit is contained in:
@@ -12,7 +12,7 @@ def register_menu():
|
||||
|
||||
The `MenuItemHook` class specifies some parameters/instance variables required for menu item display.
|
||||
|
||||
```eval_rst
|
||||
```{eval-rst}
|
||||
.. autoclass:: allianceauth.services.hooks.MenuItemHook
|
||||
:members: __init__
|
||||
:undoc-members:
|
||||
@@ -24,23 +24,22 @@ The `MenuItemHook` class specifies some parameters/instance variables required f
|
||||
|
||||
This is a great feature to signal the user, that he has some open issues to take care of within an app. For example Auth uses this feature to show the specific number of open group request to the current user.
|
||||
|
||||
```eval_rst
|
||||
.. hint::
|
||||
Here is how to stay consistent with the Auth design philosophy for using this feature:
|
||||
1. Use it to display open items that the current user can close by himself only. Do not use it for items, that the user has no control over.
|
||||
2. If there are currently no open items, do not show a badge at all.
|
||||
```
|
||||
:::{hint}
|
||||
Here is how to stay consistent with the Auth design philosophy for using this feature:
|
||||
|
||||
1. Use it to display open items that the current user can close by himself only. Do not use it for items, that the user has no control over.
|
||||
2. If there are currently no open items, do not show a badge at all.
|
||||
:::
|
||||
To use it set count the `render()` function of your subclass in accordance to the current user. Here is an example:
|
||||
|
||||
```eval_rst
|
||||
```{eval-rst}
|
||||
.. automodule:: allianceauth.services.hooks.MenuItemHook
|
||||
:members: render
|
||||
:noindex:
|
||||
:undoc-members:
|
||||
```
|
||||
|
||||
```Python
|
||||
```python
|
||||
def render(self, request):
|
||||
# ...
|
||||
self.count = calculate_count_for_user(request.user)
|
||||
|
||||
Reference in New Issue
Block a user