Commit f2fb9f285e0406d85cf3524b09e899e1e3038cd7
1 parent
d9c5a6a6
Exists in
master
and in
34 other branches
Add user documentation for plugin configuration
Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Gustavo Jaruga <darksshades@gmail.com>
Showing
1 changed file
with
16 additions
and
20 deletions
Show diff stats
docs/source/user.rst
| ... | ... | @@ -58,36 +58,32 @@ urls |
| 58 | 58 | menu |
| 59 | 59 | ++++ |
| 60 | 60 | |
| 61 | -Declares the menu structure of the app, if it exists. It is a dictionary with | |
| 62 | -the folowing keys. | |
| 61 | +These variables defines the menu title and links of the plugin. | |
| 63 | 62 | |
| 64 | -.. attribute:: title | |
| 63 | +.. attribute:: menu_title | |
| 65 | 64 | |
| 66 | - Declares the menu title. It's has a string value. | |
| 67 | -.. attribute:: links | |
| 65 | + Declares the menu title. | |
| 66 | +.. attribute:: menu_links | |
| 68 | 67 | |
| 69 | 68 | Declares the menu items and its links. |
| 70 | -.. attribute:: auth_links | |
| 71 | - | |
| 72 | - Declares the menu items and its links when the user authenticated. | |
| 73 | -.. attribute:: dependecies | |
| 69 | + This should be a tuple object with several colab_url elements. | |
| 70 | + The colab_url_factory creates a factory for your links along with your | |
| 71 | + namespace. | |
| 72 | + The auth parameter indicates wether the link should only be displayed when | |
| 73 | + the user is logged in. | |
| 74 | 74 | |
| 75 | 75 | Example: |
| 76 | 76 | |
| 77 | 77 | .. code-block:: python |
| 78 | 78 | |
| 79 | - menu = { | |
| 80 | - 'title': _('Code'), | |
| 81 | - 'links': ( | |
| 82 | - (_('Public Projects'), 'public/projects'), | |
| 83 | - ), | |
| 84 | - 'auth_links': ( | |
| 85 | - (_('Profile'), 'profile'), | |
| 86 | - (_('New Project'), 'projects/new'), | |
| 87 | - (_('Projects'), 'dashboard/projects'), | |
| 88 | - ), | |
| 89 | - } | |
| 79 | + from colab.plugins.utils.menu import colab_url_factory | |
| 80 | + | |
| 81 | + url = colab_url_factory('plugin_app_name') | |
| 90 | 82 | |
| 83 | + menu_urls = ( | |
| 84 | + url(display=_('Profile'), viewname='profile', kwargs={'path': '/profile/'}, auth=True), | |
| 85 | + url(display=_('Profile Two'), viewname='profile2', kwargs={'path': '/profile/2'}, auth=True), | |
| 86 | + ) | |
| 91 | 87 | |
| 92 | 88 | Extra Template Folders |
| 93 | 89 | ++++++++++++++++++++++ | ... | ... |