Skip to content

Commit 2e8274d

Browse files
committed
customizations: enhance menu customization docs
1 parent f95e182 commit 2e8274d

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

docs/customize/look-and-feel/menus.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1-
# Change Menus
1+
# Change Menus/Tabs
2+
3+
For navigation, InvenioRDM often uses menus or tabs. For example, one such menu is the user-dropdown menu:
4+
5+
![User-settings menu with its 5 default entries](./img/settings-menu.png)
6+
7+
And one such set of tabs is at the top of the user-dashboard:
28

3-
For navigation, InvenioRDM uses *menu*s. For example, one such menu is at the
4-
top of the dashboard shown to users on their personal page (with submenus
5-
*Uploads*, *Communities*, and *Requests*):
69
![User's personal dashboard with three tabs labeled (left-to-right) "Uploads", "Communities", and "Requests"](./img/user-dashboard.png)
7-
Menus are configurable in the following ways:
10+
11+
In the codebase, menus and sets of tabs like those are referred as *menus*, so we do so here for the remainder of this how-to as well.
12+
Their options (e.g., "Uploads", "Profile") are referred as *submenus*.
13+
14+
These *menus* can be configured in the following ways:
815

916
- which submenus to show
1017
- what title-text to show in those submenus
@@ -13,9 +20,9 @@ Menus are configurable in the following ways:
1320

1421
## Configurable Properties
1522

16-
All submenus share the following properties.
1723
Properties of existing submenus can be overridden,
1824
properties of newly added submenus can be freely chosen.
25+
All submenus share the following properties:
1926

2027
| Name | Example values | Notes |
2128
|----------------|--------------------------------------|-----------------------------------------------------|
@@ -25,7 +32,7 @@ properties of newly added submenus can be freely chosen.
2532
| `visible_when` | `flask_menu.menu.CONDITION_TRUE` | when to show this submenu<br />- must be of type `callable[[], bool]`<br />- `CONDITION_TRUE` is just a named `lambda: True`<br />- use `CONDITION_FALSE` to hide a submenu |
2633
| ... | ... | in addtion to the above properties, all arguments for `flask_menu.menu:MenuNode.register` are configurable |
2734

28-
For an example consider the user-dashboard pictured above.
35+
For example, consider the user-dashboard pictured above.
2936
Its *Uploads* submenu has the following default configuration:
3037
```python
3138
{
@@ -42,9 +49,9 @@ Its *Uploads* submenu has the following default configuration:
4249
Existing menus can be extended by custom-configured submenus.
4350
To add a new submenu to an existing menu:
4451

45-
1. get the name of the to-be-added-to menu from the [list of menus](#list-of-menus)
52+
1. Get the name of the to-be-added-to menu from the [list of menus](#list-of-menus)
4653
For example, the user-dashboard is named `"dashboard"` (most names of menus/submenus are straightforward).
47-
2. write a function that registers the new submenu
54+
2. Write a function that registers the new submenu
4855
```python
4956
# ext.py # ext.py is commonly used, you may use another file though
5057

@@ -67,9 +74,9 @@ To add a new submenu to an existing menu:
6774

6875
... # could .register more submenus here (or do so in another package)
6976
```
70-
3. have the endpoint `invenio_base.finalize_app` point at your function
71-
This will make your function be called at the app-finalization build-step.
72-
For example, when using setuptools' `setup.cfg` with your python-package, add:
77+
3. Register your function with the `invenio_base.finalize_app` entrypoint.
78+
This will make your function be called at the app-finalization build-step.
79+
For example, when using setuptools' `setup.cfg` with your python package, add:
7380
```ini
7481
# setup.cfg
7582

@@ -82,8 +89,7 @@ To add a new submenu to an existing menu:
8289
For entrypoint changes to be picked up, you will need to reinstall the python package.
8390
*This is necessary even if the package is installed editably!*
8491

85-
!!! info "Have you tried to turn it off and on again?"
86-
After entrypoint changes were picked up,
92+
After entrypoint changes are picked up,
8793
you will further need to restart the server for changes to take effect:
8894
```shell
8995
<CTRL+C>
@@ -95,12 +101,12 @@ To add a new submenu to an existing menu:
95101
The defaults of submenus' properties are selectively overridable via config-variables.
96102
To modify an existing submenu's properties:
97103

98-
1. find the name of the corresponding override-variable in the [list of menus](#list-of-menus)
104+
1. Find the name of the corresponding override-variable in the [list of menus](#list-of-menus)
99105
For example, the override-variable for the user-dashboard is named `USER_DASHBOARD_MENU_OVERRIDES`.
100-
2. find the name of the to-be-overridden submenu in that same [list of menus](#list-of-menus)
106+
2. Find the name of the to-be-overridden submenu in that same [list of menus](#list-of-menus)
101107
For example, the user-dashboard has a submenu for communities.
102108
This submenu is named (obviously enough) `"communities"`.
103-
3. add to your `invenio.cfg`:
109+
3. Add to your `invenio.cfg`:
104110
```python
105111
# invenio.cfg
106112

0 commit comments

Comments
 (0)