MyST conversion

This commit is contained in:
Ariel Rin
2023-10-31 23:31:41 +10:00
parent 7024552c4e
commit 98e91fe207
25 changed files with 348 additions and 332 deletions

View File

@@ -4,10 +4,10 @@ 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-users fa-fw', 'example_url_name',150)
```
The `MenuItemHook` class specifies some parameters/instance variables required for menu item display.
@@ -41,13 +41,14 @@ A list of views or namespaces the link should be highlighted on. See [django-nav
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.
:::{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.
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:
```Python
```python
def render(self, request):
# ...
self.count = calculate_count_for_user(request.user)