mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
frontpage: Allow showing links to manual pages
Tests: - Run updated unit tests. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
bf86990382
commit
f4c3b4326c
@ -20,8 +20,9 @@ class Shortcut(app.FollowerComponent):
|
||||
_all_shortcuts = {}
|
||||
|
||||
def __init__(self, component_id, name, short_description=None, icon=None,
|
||||
url=None, description=None, configure_url=None, clients=None,
|
||||
login_required=False, allowed_groups=None):
|
||||
url=None, description=None, manual_page=None,
|
||||
configure_url=None, clients=None, login_required=False,
|
||||
allowed_groups=None):
|
||||
"""Initialize the frontpage shortcut component for an app.
|
||||
|
||||
When a user visits this web interface, they are first shown the
|
||||
@ -48,6 +49,10 @@ class Shortcut(app.FollowerComponent):
|
||||
the shortcut is activated. This must be provided instead of 'url' and
|
||||
must be 'None' if 'url' is provided.
|
||||
|
||||
'manual_page' is the optional name of the page for this app in the user
|
||||
manual. If provided, a 'Learn more...' link appears in the app page for
|
||||
this app.
|
||||
|
||||
'configure_url' is the page to which the user may be redirected if they
|
||||
wish to change the settings for the app or one of its services. This is
|
||||
only used when 'url' is 'None'. It is optionally provided along with
|
||||
@ -78,6 +83,7 @@ class Shortcut(app.FollowerComponent):
|
||||
self.url = url
|
||||
self.icon = icon
|
||||
self.description = description
|
||||
self.manual_page = manual_page
|
||||
self.configure_url = configure_url
|
||||
self.clients = clients
|
||||
self.login_required = login_required
|
||||
|
||||
@ -30,6 +30,7 @@ def test_shortcut_init_with_arguments():
|
||||
assert shortcut.url == '?selected=test-component'
|
||||
assert shortcut.icon is None
|
||||
assert shortcut.description is None
|
||||
assert shortcut.manual_page is None
|
||||
assert shortcut.configure_url is None
|
||||
assert shortcut.clients is None
|
||||
assert not shortcut.login_required
|
||||
@ -44,13 +45,14 @@ def test_shortcut_init():
|
||||
shortcut = Shortcut('test-component', name='test-name',
|
||||
short_description='test-short-description',
|
||||
url='test-url', icon='test-icon',
|
||||
description='test-description',
|
||||
description='test-description', manual_page='TestPage',
|
||||
configure_url='test-configure-url', clients=clients,
|
||||
login_required=True, allowed_groups=allowed_groups)
|
||||
assert shortcut.short_description == 'test-short-description'
|
||||
assert shortcut.url == 'test-url'
|
||||
assert shortcut.icon == 'test-icon'
|
||||
assert shortcut.description == 'test-description'
|
||||
assert shortcut.manual_page == 'TestPage'
|
||||
assert shortcut.configure_url == 'test-configure-url'
|
||||
assert shortcut.clients == clients
|
||||
assert shortcut.login_required
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user