diff --git a/plinth/templates/clients.html b/plinth/templates/clients.html index 7d86d0bcc..3e3d65e07 100644 --- a/plinth/templates/clients.html +++ b/plinth/templates/clients.html @@ -30,13 +30,28 @@

- {% if clients|has_web_clients %} - {% for client in clients %} - {% if client|has_web_clients %} - {% for platform in client.platforms %} + + {% if clients|has_web_clients %} + {% with clients|of_type:'web' as web_clients %} + + + {% with web_clients|first as client %} + {% for platform in client.platforms %} {% if platform.type == 'web' %} + + + {% endif %} + {% endfor %} + {% endwith %} + + {% for client in web_clients|slice:"1:" %} + {% for platform in client.platforms %} + {% if platform.type == 'web' %} - - {% endif %} + {% endif %} + {% endfor %} {% endfor %} - {% endif %} - {% endfor %} - {% endif %} + {% endwith %} + {% endif %} {% if clients|has_desktop_clients %} - {% for client in clients %} - {% if client|has_desktop_clients %} - - - - - - {% endif %} + {% with clients|of_type:'desktop' as desktop_clients %} + + + {% with desktop_clients|first as client %} + + + {% endwith %} + + {% for client in desktop_clients|slice:"1:" %} + + + + {% endfor %} + {% endwith %} {% endif %} {% if clients|has_mobile_clients %} - {% for client in clients %} - {% if client|has_mobile_clients %} + {% with clients|of_type:'mobile' as mobile_clients %} + + + {% with mobile_clients|first as client %} + + + {% endwith %} + + {% for client in mobile_clients|slice:"1:" %} - - {% endif %} {% endfor %} + {% endwith %} {% endif %} +
Web {{ client.name }} + + + +
Web {{ client.name }} @@ -44,43 +59,83 @@
Desktop {{ client.name }} -
- {% for platform in client.platforms %} - {% if platform.type == 'download' %} - - {% endif %} - {% endfor %} -
-
Desktop {{ client.name }} +
+ {% for platform in client.platforms %} + {% if platform.type == 'download' %} + + {% endif %} + {% endfor %} +
+
{{ client.name }} +
+ {% for platform in client.platforms %} + {% if platform.type == 'download' %} + + {% endif %} + {% endfor %} +
+
Mobile {{ client.name }} +
+ {% for platform in client.platforms %} + {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %} + + {% endif %} + {% endfor %} +
+
Mobile {{ client.name }}
@@ -98,9 +153,10 @@
{% endif %} diff --git a/plinth/templatetags/plinth_extras.py b/plinth/templatetags/plinth_extras.py index 70a5180c9..0b13671fb 100644 --- a/plinth/templatetags/plinth_extras.py +++ b/plinth/templatetags/plinth_extras.py @@ -108,3 +108,16 @@ def has_mobile_clients(clients): def has_web_clients(clients): """Filter to find out whether an application has web clients""" return __check(clients, lambda x: x['type'] == 'web') + + +@register.filter(name='of_type') +def of_type(clients, typ): + """Filter clients of a particular type""" + if typ == 'mobile': + return list(filter(has_mobile_clients, clients)) + elif typ == 'desktop': + return list(filter(has_desktop_clients, clients)) + elif typ == 'web': + return list(filter(has_web_clients, clients)) + else: + return clients