mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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 = {}
|
_all_shortcuts = {}
|
||||||
|
|
||||||
def __init__(self, component_id, name, short_description=None, icon=None,
|
def __init__(self, component_id, name, short_description=None, icon=None,
|
||||||
url=None, description=None, configure_url=None, clients=None,
|
url=None, description=None, manual_page=None,
|
||||||
login_required=False, allowed_groups=None):
|
configure_url=None, clients=None, login_required=False,
|
||||||
|
allowed_groups=None):
|
||||||
"""Initialize the frontpage shortcut component for an app.
|
"""Initialize the frontpage shortcut component for an app.
|
||||||
|
|
||||||
When a user visits this web interface, they are first shown the
|
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
|
the shortcut is activated. This must be provided instead of 'url' and
|
||||||
must be 'None' if 'url' is provided.
|
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
|
'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
|
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
|
only used when 'url' is 'None'. It is optionally provided along with
|
||||||
@ -78,6 +83,7 @@ class Shortcut(app.FollowerComponent):
|
|||||||
self.url = url
|
self.url = url
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
self.description = description
|
self.description = description
|
||||||
|
self.manual_page = manual_page
|
||||||
self.configure_url = configure_url
|
self.configure_url = configure_url
|
||||||
self.clients = clients
|
self.clients = clients
|
||||||
self.login_required = login_required
|
self.login_required = login_required
|
||||||
|
|||||||
@ -30,6 +30,7 @@ def test_shortcut_init_with_arguments():
|
|||||||
assert shortcut.url == '?selected=test-component'
|
assert shortcut.url == '?selected=test-component'
|
||||||
assert shortcut.icon is None
|
assert shortcut.icon is None
|
||||||
assert shortcut.description is None
|
assert shortcut.description is None
|
||||||
|
assert shortcut.manual_page is None
|
||||||
assert shortcut.configure_url is None
|
assert shortcut.configure_url is None
|
||||||
assert shortcut.clients is None
|
assert shortcut.clients is None
|
||||||
assert not shortcut.login_required
|
assert not shortcut.login_required
|
||||||
@ -44,13 +45,14 @@ def test_shortcut_init():
|
|||||||
shortcut = Shortcut('test-component', name='test-name',
|
shortcut = Shortcut('test-component', name='test-name',
|
||||||
short_description='test-short-description',
|
short_description='test-short-description',
|
||||||
url='test-url', icon='test-icon',
|
url='test-url', icon='test-icon',
|
||||||
description='test-description',
|
description='test-description', manual_page='TestPage',
|
||||||
configure_url='test-configure-url', clients=clients,
|
configure_url='test-configure-url', clients=clients,
|
||||||
login_required=True, allowed_groups=allowed_groups)
|
login_required=True, allowed_groups=allowed_groups)
|
||||||
assert shortcut.short_description == 'test-short-description'
|
assert shortcut.short_description == 'test-short-description'
|
||||||
assert shortcut.url == 'test-url'
|
assert shortcut.url == 'test-url'
|
||||||
assert shortcut.icon == 'test-icon'
|
assert shortcut.icon == 'test-icon'
|
||||||
assert shortcut.description == 'test-description'
|
assert shortcut.description == 'test-description'
|
||||||
|
assert shortcut.manual_page == 'TestPage'
|
||||||
assert shortcut.configure_url == 'test-configure-url'
|
assert shortcut.configure_url == 'test-configure-url'
|
||||||
assert shortcut.clients == clients
|
assert shortcut.clients == clients
|
||||||
assert shortcut.login_required
|
assert shortcut.login_required
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user