clients: implement launch button feature

Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Alice Kile authored and Joseph Nuthalapati committed 2019-11-18 19:41:14 +05:30
1 parent 42949bf212
commit 8e3bbdb089
7 files changed
+22 -13

No files matched your search

@@ -42,10 +42,6 @@
{% endif %}
</p>
<p>
<a href='{% url "jsxc:jsxc" %}' target='_blank' class='btn btn-primary'>
{% trans "Launch web client" %}</a>
</p>
{% endblock %}
-5
View File
@@ -26,11 +26,6 @@
<p>{{ paragraph|safe }}</p>
{% endfor %}
<p>
<a href='{% url "jsxc:jsxc" %}' target='_blank' class='btn btn-primary'>
{% trans "Launch web client" %}</a>
</p>
{% endblock %}
{% block configuration %}
+1 -1
View File
@@ -29,6 +29,6 @@ urlpatterns = [
AppView.as_view(app_id='roundcube', name=roundcube.name,
diagnostics_module_name='roundcube',
description=roundcube.description,
show_status_block=False,
show_status_block=False, clients=roundcube.clients,
manual_page=roundcube.manual_page), name='index'),
]
+14 -1
View File
@@ -45,7 +45,20 @@
</p>
{% endif %}
{% include "clients.html" with clients=clients enabled=is_enabled %}
{% if clients|length == 1 and clients|first|lookup:'platforms'|length == 1 and clients|first|lookup:'platforms'|first|lookup:'type' == 'web' %}
{% block launch_button %}
<p>
<a href='{{ clients|first|lookup:"platforms"|first|lookup:"url" }}' target='_blank' class='btn btn-primary'>
{% trans "Launch web client" %}</a>
</p>
{% endblock %}
{% else %}
{% include "clients.html" with clients=clients enabled=is_enabled %}
{% endif %}
{% block subsubmenu %}
{% if subsubmenu %}
+1 -1
View File
@@ -44,7 +44,7 @@
<td>{{ client.name }}</td>
<td>
<a target="_blank" rel="noopener noreferrer"
class="btn btn-success" role="button"
class="btn btn-default" role="button"
{% if not enabled %} disabled="disabled"
{% else %} href="{{ platform.url }}"
{% endif %}>
+6
View File
@@ -67,3 +67,9 @@ def show_subsubmenu(context, menu):
def clients_of_type(clients, client_type):
"""Filter and get clients of a particular type"""
return clients_module.of_type(clients, client_type)
@register.filter(name='lookup')
def lookup(dictionary, key):
"""Get the value in the dictionary at given key"""
return dictionary[key]
-1
View File
@@ -76,7 +76,6 @@ def is_user_admin(request, cached=False):
class YAMLFile(object):
"""A context management class for updating YAML files"""
def __init__(self, yaml_file):
"""Return a context object for the YAML file.