From 0b1b8157e4cf9b29eb7f3e9f45033100f7c5cfe8 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Mon, 20 Nov 2017 17:53:02 +0530 Subject: [PATCH] Add package names (Debian and Homebrew) as a client entry Signed-off-by: Joseph Nuthalapati Reviewed-by: James Valleroy --- plinth/modules/ejabberd/manifest.py | 4 +- plinth/modules/infinoted/manifest.py | 4 +- plinth/modules/jsxc/manifest.py | 4 +- plinth/modules/quassel/manifest.py | 4 +- plinth/modules/radicale/manifest.py | 8 +- plinth/templates/clients.html | 308 +++++++++++++++------------ plinth/templatetags/plinth_extras.py | 9 +- 7 files changed, 197 insertions(+), 144 deletions(-) diff --git a/plinth/modules/ejabberd/manifest.py b/plinth/modules/ejabberd/manifest.py index b80eca90a..99356751e 100644 --- a/plinth/modules/ejabberd/manifest.py +++ b/plinth/modules/ejabberd/manifest.py @@ -86,8 +86,8 @@ _clients = [{ _('Gajim'), 'platforms': [{ 'type': 'package', - 'os': 'Debian', - 'package_name': 'gajim' + 'format': 'deb', + 'name': 'gajim' }, { 'type': 'download', 'os': Desktop_OS.WINDOWS.value, diff --git a/plinth/modules/infinoted/manifest.py b/plinth/modules/infinoted/manifest.py index 46b1d3502..3d2fc11e1 100644 --- a/plinth/modules/infinoted/manifest.py +++ b/plinth/modules/infinoted/manifest.py @@ -37,7 +37,7 @@ clients = [{ 'url': 'http://releases.0x539.de/gobby/gobby-stable.exe' }, { 'type': 'package', - 'os': 'Debian', - 'package_name': 'gobby' + 'format': 'deb', + 'name': 'gobby' }] }] diff --git a/plinth/modules/jsxc/manifest.py b/plinth/modules/jsxc/manifest.py index 4c83196e8..dcfee1c40 100644 --- a/plinth/modules/jsxc/manifest.py +++ b/plinth/modules/jsxc/manifest.py @@ -22,8 +22,8 @@ clients = [{ _('JSXC'), 'platforms': [{ 'type': 'package', - 'os': 'Debian', - 'package_name': 'libjs-jsxc' + 'format': 'deb', + 'name': 'libjs-jsxc' }, { 'type': 'web', 'url': '/jsxc' diff --git a/plinth/modules/quassel/manifest.py b/plinth/modules/quassel/manifest.py index f763f28ff..976e67769 100644 --- a/plinth/modules/quassel/manifest.py +++ b/plinth/modules/quassel/manifest.py @@ -32,8 +32,8 @@ clients = [{ 'url': quassel_download_url, }, { 'type': 'package', - 'os': 'Debian', - 'package_name': 'quassel-client', + 'format': 'deb', + 'name': 'quassel-client', }] }, { 'name': diff --git a/plinth/modules/radicale/manifest.py b/plinth/modules/radicale/manifest.py index ec44426f9..01029dae1 100644 --- a/plinth/modules/radicale/manifest.py +++ b/plinth/modules/radicale/manifest.py @@ -41,8 +41,8 @@ clients = [{ _('GNOME Calendar'), 'platforms': [{ 'type': 'package', - 'os': 'Debian', - 'package-name': 'gnome-calendar' + 'format': 'deb', + 'name': 'gnome-calendar' }] }, { 'name': @@ -59,7 +59,7 @@ clients = [{ 'calendars and address books.'), 'platforms': [{ 'type': 'package', - 'os': 'Debian', - 'package-name': 'gnome-calendar' + 'format': 'deb', + 'name': 'evolution' }] }] diff --git a/plinth/templates/clients.html b/plinth/templates/clients.html index 3e3d65e07..df3bca305 100644 --- a/plinth/templates/clients.html +++ b/plinth/templates/clients.html @@ -22,141 +22,187 @@ {% load static %} {% if clients %} -

- -

+

+ +

- +
- {% 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 %} - {% endfor %} - {% endfor %} - {% endwith %} - {% endif %} + {% 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 %} + {% endfor %} + {% endfor %} + {% endwith %} + {% endif %} - {% if clients|has_desktop_clients %} - {% 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_desktop_clients %} + {% 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 %} - {% with clients|of_type:'mobile' as mobile_clients %} - - - {% with mobile_clients|first as client %} - - - {% endwith %} - - {% for client in mobile_clients|slice:"1:" %} - - - - - {% endfor %} - {% endwith %} - {% endif %} + {% if clients|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:" %} + + + + + {% endfor %} + {% endwith %} + {% endif %} -
Web {{ client.name }} - - - -
{{ client.name }} - - - -
Web {{ client.name }} + + + +
{{ client.name }} + + + +
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 %} -
-
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 %} -
-
{{ client.name }} -
- {% for platform in client.platforms %} - {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %} - - {% endif %} - {% endfor %} -
-
Mobile {{ client.name }} +
+ {% for platform in client.platforms %} + {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %} + + {% endif %} + {% endfor %} +
+
{{ client.name }} +
+ {% for platform in client.platforms %} + {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %} + + {% endif %} + {% endfor %} +
+
+ {% if clients|has_package_clients %} + {% with clients|of_type:'package' as package_clients %} + + Package + {% with package_clients|first as client %} + {{ client.name }} + +
+
    + {% for platform in client.platforms %} + {% if platform.type == 'package' and platform.format == 'deb' %} +
  • Debian: {{ platform.name }}
  • + {% endif %} + {% if platform.type == 'package' and platform.format == 'homebrew' %} +
  • HomeBrew: {{ platform.name }}
  • + {% endif %} + {% endfor %} +
+
+ + {% endwith %} + + {% for client in package_clients|slice:"1:" %} + + {{ client.name }} + +
+
    + {% for platform in client.platforms %} + {% if platform.type == 'package' %} + {% if platform.type == 'package' and platform.format == 'deb' %} +
  • Debian: {{ platform.name }}
  • + {% endif %} + {% if platform.type == 'package' and platform.format == 'homebrew' %} +
  • HomeBrew: {{ platform.name }}
  • + {% endif %} + {% endif %} + {% endfor %} +
+
+ + + {% endfor %} + {% endwith %} + {% endif %} + + {% endif %} diff --git a/plinth/templatetags/plinth_extras.py b/plinth/templatetags/plinth_extras.py index efe4541cf..b292d0f34 100644 --- a/plinth/templatetags/plinth_extras.py +++ b/plinth/templatetags/plinth_extras.py @@ -110,12 +110,19 @@ def has_web_clients(clients): return __check(clients, lambda x: x['type'] == 'web') +@register.filter(name='has_package_clients') +def has_package_clients(clients): + """Filter to find out whether an application has web clients""" + return __check(clients, lambda x: x['type'] == 'package') + + @register.filter(name='of_type') def of_type(clients, typ): """Filter and get clients of a particular type""" filters = { 'mobile': has_mobile_clients, 'desktop': has_desktop_clients, - 'web': has_web_clients + 'web': has_web_clients, + 'package': has_package_clients, } return list(filter(filters.get(typ, lambda x: x), clients))