mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Introduce component architecture and menu component
- Introduce base class for all apps that will contain components. With
unittests.
- Introduce base classes for components. With unittests.
- Turn Menu class into an app component.
- Further cleanup Menu class.
- Update tests.
- Maintain a global list of menu items and look them up easily. Generalize
such that subsubmenus can later be merged into Menu class.
- Cleanup scope of main menu initialization.
- Use None instead of empty strings for various values. Ensure that
printing short_description does not show 'None' in output.
- Use enable/disable instead of promote/demote.
- Use menu component in all apps.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
61 files changed
+1527
-567
No files matched your search
@@ -23,7 +23,8 @@ import subprocess
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from plinth import action_utils, actions
|
||||
from plinth.menu import main_menu
|
||||
from plinth import app as app_module
|
||||
from plinth import menu
|
||||
|
||||
version = 2
|
||||
|
||||
@@ -47,11 +48,25 @@ name = _('Users and Groups')
|
||||
# All FreedomBox user groups
|
||||
groups = dict()
|
||||
|
||||
app = None
|
||||
|
||||
|
||||
class UsersApp(app_module.App):
|
||||
"""FreedomBox app for users and groups management."""
|
||||
|
||||
def __init__(self):
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
menu_item = menu.Menu('menu-users', name, None, 'fa-users',
|
||||
'users:index', parent_url_name='system')
|
||||
self.add(menu_item)
|
||||
|
||||
|
||||
def init():
|
||||
"""Intialize the user module."""
|
||||
menu = main_menu.get('system')
|
||||
menu.add_urlname(name, 'fa-users', 'users:index')
|
||||
global app
|
||||
app = UsersApp()
|
||||
app.set_enabled(True)
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
|
||||
Reference in new issue
Block a user