mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
frontpage: Show Configure button in service details
Only show when user is logged in.
This commit is contained in:
parent
9ca42fd271
commit
8f147e4c7f
@ -27,7 +27,8 @@ def get_shortcuts():
|
|||||||
return sorted(shortcuts.values(), key=lambda item: item['label'])
|
return sorted(shortcuts.values(), key=lambda item: item['label'])
|
||||||
|
|
||||||
|
|
||||||
def add_shortcut(id, label, url, icon, details=None, login_required=False):
|
def add_shortcut(id, label, url, icon, details=None, configure_url=None,
|
||||||
|
login_required=False):
|
||||||
"""Add shortcut to front page."""
|
"""Add shortcut to front page."""
|
||||||
|
|
||||||
if not url:
|
if not url:
|
||||||
@ -40,6 +41,7 @@ def add_shortcut(id, label, url, icon, details=None, login_required=False):
|
|||||||
'icon': icon,
|
'icon': icon,
|
||||||
'login_required': login_required,
|
'login_required': login_required,
|
||||||
'details': details,
|
'details': details,
|
||||||
|
'configure_url': configure_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,8 @@ description = [
|
|||||||
'is needed.'), box_name=_(cfg.box_name)),
|
'is needed.'), box_name=_(cfg.box_name)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
configure_url = _('apps/minetest')
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the module."""
|
"""Initialize the module."""
|
||||||
@ -75,7 +77,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('minetest', title, None, 'glyphicon-th-large',
|
frontpage.add_shortcut('minetest', title, None, 'glyphicon-th-large',
|
||||||
description, login_required=False)
|
description, configure_url,
|
||||||
|
login_required=False)
|
||||||
|
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
|
|||||||
@ -51,6 +51,9 @@ description = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
configure_url = _('apps/mumble')
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Intialize the Mumble module."""
|
"""Intialize the Mumble module."""
|
||||||
menu = cfg.main_menu.get('apps:index')
|
menu = cfg.main_menu.get('apps:index')
|
||||||
@ -80,7 +83,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('mumble', title, None, 'glyphicon-headphones',
|
frontpage.add_shortcut('mumble', title, None, 'glyphicon-headphones',
|
||||||
description, login_required=False)
|
description, configure_url,
|
||||||
|
login_required=False)
|
||||||
|
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
|
|||||||
@ -54,9 +54,12 @@ description = [
|
|||||||
'While using Privoxy, you can see its configuration details and '
|
'While using Privoxy, you can see its configuration details and '
|
||||||
'documentation at '
|
'documentation at '
|
||||||
'<a href="http://config.privoxy.org">http://config.privoxy.org/</a> '
|
'<a href="http://config.privoxy.org">http://config.privoxy.org/</a> '
|
||||||
'or <a href="http://p.p">http://p.p</a>.'), box_name=_(cfg.box_name))
|
'or <a href="http://p.p">http://p.p</a>.'),
|
||||||
|
box_name=_(cfg.box_name)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
configure_url = _('apps/privoxy')
|
||||||
|
|
||||||
service = None
|
service = None
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +87,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('privoxy', title, None, 'glyphicon-cloud-upload',
|
frontpage.add_shortcut('privoxy', title, None, 'glyphicon-cloud-upload',
|
||||||
description, login_required=True)
|
description, configure_url,
|
||||||
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
|
|||||||
@ -55,9 +55,11 @@ description = [
|
|||||||
'4242. Clients to connect to Quassel from your '
|
'4242. Clients to connect to Quassel from your '
|
||||||
'<a href="http://quassel-irc.org/downloads">desktop</a> and '
|
'<a href="http://quassel-irc.org/downloads">desktop</a> and '
|
||||||
'<a href="http://quasseldroid.iskrembilen.com/">mobile</a> devices '
|
'<a href="http://quasseldroid.iskrembilen.com/">mobile</a> devices '
|
||||||
'are available.')
|
'are available.'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
configure_url = _('apps/quassel')
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"""Initialize the quassel module."""
|
"""Initialize the quassel module."""
|
||||||
@ -88,7 +90,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('quassel', title, None, 'glyphicon-retweet',
|
frontpage.add_shortcut('quassel', title, None, 'glyphicon-retweet',
|
||||||
description, login_required=True)
|
description, configure_url,
|
||||||
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
|
|||||||
@ -51,6 +51,8 @@ description = [
|
|||||||
'login.'), box_name=_(cfg.box_name)),
|
'login.'), box_name=_(cfg.box_name)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
configure_url = _('apps/radicale')
|
||||||
|
|
||||||
CONFIG_FILE = '/etc/radicale/config'
|
CONFIG_FILE = '/etc/radicale/config'
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +80,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('radicale', title, None, 'glyphicon-calendar',
|
frontpage.add_shortcut('radicale', title, None, 'glyphicon-calendar',
|
||||||
description, login_required=True)
|
description, configure_url,
|
||||||
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
|
|||||||
@ -59,6 +59,8 @@ description = [
|
|||||||
'service and re-enable it.'),
|
'service and re-enable it.'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
configure_url = _('apps/repro')
|
||||||
|
|
||||||
service = None
|
service = None
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +94,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('repro', title, None, 'glyphicon-phone-alt',
|
frontpage.add_shortcut('repro', title, None, 'glyphicon-phone-alt',
|
||||||
description, login_required=True)
|
description, configure_url,
|
||||||
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
|
|||||||
@ -49,9 +49,11 @@ description = [
|
|||||||
|
|
||||||
_('To actually communicate, you can use the web client or any other '
|
_('To actually communicate, you can use the web client or any other '
|
||||||
'<a href=\'http://xmpp.org/xmpp-software/clients/\' target=\'_blank\''
|
'<a href=\'http://xmpp.org/xmpp-software/clients/\' target=\'_blank\''
|
||||||
'>XMPP client</a>.')
|
'>XMPP client</a>.'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
configure_url = _('apps/xmpp')
|
||||||
|
|
||||||
service = None
|
service = None
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -92,9 +94,10 @@ def setup(helper, old_version=None):
|
|||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('jsxc', _('Chat Client (jsxc)'),
|
frontpage.add_shortcut('jsxc', _('Chat Client (jsxc)'),
|
||||||
reverse_lazy('xmpp:jsxc'), 'glyphicon-comment',
|
reverse_lazy('xmpp:jsxc'), 'glyphicon-comment',
|
||||||
login_required=True)
|
None, login_required=True)
|
||||||
frontpage.add_shortcut('xmpp', title, None, 'glyphicon-comment',
|
frontpage.add_shortcut('xmpp', title, None, 'glyphicon-comment',
|
||||||
description, login_required=True)
|
description, configure_url,
|
||||||
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
def is_enabled():
|
def is_enabled():
|
||||||
|
|||||||
@ -70,6 +70,13 @@
|
|||||||
{{ paragraph|safe }}
|
{{ paragraph|safe }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<div class="panel-body">
|
||||||
|
<a href="{{ configure_url }}">Configure</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@ -38,17 +38,19 @@ def index(request):
|
|||||||
shortcuts = frontpage.get_shortcuts()
|
shortcuts = frontpage.get_shortcuts()
|
||||||
selection = request.GET.get('selected')
|
selection = request.GET.get('selected')
|
||||||
|
|
||||||
details, details_label = None, None
|
details, details_label, configure_url = None, None, None
|
||||||
if selection in frontpage.shortcuts:
|
if selection in frontpage.shortcuts:
|
||||||
details = frontpage.shortcuts[selection]['details']
|
details = frontpage.shortcuts[selection]['details']
|
||||||
details_label = frontpage.shortcuts[selection]['label']
|
details_label = frontpage.shortcuts[selection]['label']
|
||||||
|
configure_url = frontpage.shortcuts[selection]['configure_url']
|
||||||
|
|
||||||
return TemplateResponse(request, 'index.html',
|
return TemplateResponse(request, 'index.html',
|
||||||
{'title': _('FreedomBox'),
|
{'title': _('FreedomBox'),
|
||||||
'shortcuts': shortcuts,
|
'shortcuts': shortcuts,
|
||||||
'selected_id': selection,
|
'selected_id': selection,
|
||||||
'details': details,
|
'details': details,
|
||||||
'details_label': details_label})
|
'details_label': details_label,
|
||||||
|
'configure_url': configure_url})
|
||||||
|
|
||||||
|
|
||||||
class ServiceView(FormView):
|
class ServiceView(FormView):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user