Add package names (Debian and Homebrew) as a client entry

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2017-11-20 17:53:02 +05:30 committed by James Valleroy
parent 9ac7ff10ce
commit 0b1b8157e4
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
7 changed files with 197 additions and 144 deletions

View File

@ -86,8 +86,8 @@ _clients = [{
_('Gajim'), _('Gajim'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'os': 'Debian', 'format': 'deb',
'package_name': 'gajim' 'name': 'gajim'
}, { }, {
'type': 'download', 'type': 'download',
'os': Desktop_OS.WINDOWS.value, 'os': Desktop_OS.WINDOWS.value,

View File

@ -37,7 +37,7 @@ clients = [{
'url': 'http://releases.0x539.de/gobby/gobby-stable.exe' 'url': 'http://releases.0x539.de/gobby/gobby-stable.exe'
}, { }, {
'type': 'package', 'type': 'package',
'os': 'Debian', 'format': 'deb',
'package_name': 'gobby' 'name': 'gobby'
}] }]
}] }]

View File

@ -22,8 +22,8 @@ clients = [{
_('JSXC'), _('JSXC'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'os': 'Debian', 'format': 'deb',
'package_name': 'libjs-jsxc' 'name': 'libjs-jsxc'
}, { }, {
'type': 'web', 'type': 'web',
'url': '/jsxc' 'url': '/jsxc'

View File

@ -32,8 +32,8 @@ clients = [{
'url': quassel_download_url, 'url': quassel_download_url,
}, { }, {
'type': 'package', 'type': 'package',
'os': 'Debian', 'format': 'deb',
'package_name': 'quassel-client', 'name': 'quassel-client',
}] }]
}, { }, {
'name': 'name':

View File

@ -41,8 +41,8 @@ clients = [{
_('GNOME Calendar'), _('GNOME Calendar'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'os': 'Debian', 'format': 'deb',
'package-name': 'gnome-calendar' 'name': 'gnome-calendar'
}] }]
}, { }, {
'name': 'name':
@ -59,7 +59,7 @@ clients = [{
'calendars and address books.'), 'calendars and address books.'),
'platforms': [{ 'platforms': [{
'type': 'package', 'type': 'package',
'os': 'Debian', 'format': 'deb',
'package-name': 'gnome-calendar' 'name': 'evolution'
}] }]
}] }]

View File

@ -22,141 +22,187 @@
{% load static %} {% load static %}
{% if clients %} {% if clients %}
<p> <p>
<button id="collapsible-button" type="button" class="btn btn-default collapsed" <button id="collapsible-button" type="button" class="btn btn-default collapsed"
data-toggle="collapse" data-target="#clients"> data-toggle="collapse" data-target="#clients">
Client Apps Client Apps
</button> </button>
</p> </p>
<table id="clients" class="table table-hover collapse"> <table id="clients" class="table table-hover collapse">
{% if clients|has_web_clients %} {% if clients|has_web_clients %}
{% with clients|of_type:'web' as web_clients %} {% with clients|of_type:'web' as web_clients %}
<tr> <tr>
<th rowspan=" {{ web_clients|length }}"> Web </th> <th rowspan=" {{ web_clients|length }}"> Web </th>
{% with web_clients|first as client %} {% with web_clients|first as client %}
{% for platform in client.platforms %} {% for platform in client.platforms %}
{% if platform.type == 'web' %} {% if platform.type == 'web' %}
<td> {{ client.name }} </td> <td> {{ client.name }} </td>
<td> <td>
<a href="{{ platform.url }}"> <a href="{{ platform.url }}">
<button type="button" class="btn btn-success">Launch</button> <button type="button" class="btn btn-success">Launch</button>
</a> </a>
</td> </td>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endwith %} {% endwith %}
</tr> </tr>
{% for client in web_clients|slice:"1:" %} {% for client in web_clients|slice:"1:" %}
{% for platform in client.platforms %} {% for platform in client.platforms %}
{% if platform.type == 'web' %} {% if platform.type == 'web' %}
<tr> <tr>
<td> {{ client.name }} </td> <td> {{ client.name }} </td>
<td> <td>
<a href="{{ platform.url }}"> <a href="{{ platform.url }}">
<button type="button" class="btn btn-success">Launch</button> <button type="button" class="btn btn-success">Launch</button>
</a> </a>
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{% if clients|has_desktop_clients %} {% if clients|has_desktop_clients %}
{% with clients|of_type:'desktop' as desktop_clients %} {% with clients|of_type:'desktop' as desktop_clients %}
<tr> <tr>
<th rowspan="{{ desktop_clients|length }}"> Desktop </th> <th rowspan="{{ desktop_clients|length }}"> Desktop </th>
{% with desktop_clients|first as client %} {% with desktop_clients|first as client %}
<td> {{ client.name }} </td> <td> {{ client.name }} </td>
<td> <td>
<div class ="row"> <div class ="row">
{% for platform in client.platforms %} {% for platform in client.platforms %}
{% if platform.type == 'download' %} {% if platform.type == 'download' %}
<div class="col-md-2 col-xs-4"> <div class="col-md-2 col-xs-4">
<a href="{{ platform.url }}"> <a href="{{ platform.url }}">
{% with 'theme/icons/'|add:platform.os|add:'.png' as icon %} {% with 'theme/icons/'|add:platform.os|add:'.png' as icon %}
<img class="os-icon" src="{% static icon %}" /> <img class="os-icon" src="{% static icon %}" />
{% endwith %} {% endwith %}
</a> </a>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</td> </td>
{% endwith %} {% endwith %}
</tr> </tr>
{% for client in desktop_clients|slice:"1:" %} {% for client in desktop_clients|slice:"1:" %}
<tr> <tr>
<td> {{ client.name }} </td> <td> {{ client.name }} </td>
<td> <td>
<div class ="row"> <div class ="row">
{% for platform in client.platforms %} {% for platform in client.platforms %}
{% if platform.type == 'download' %} {% if platform.type == 'download' %}
<div class="col-md-2 col-xs-4"> <div class="col-md-2 col-xs-4">
<a href="{{ platform.url }}"> <a href="{{ platform.url }}">
{% with 'theme/icons/'|add:platform.os|add:'.png' as icon %} {% with 'theme/icons/'|add:platform.os|add:'.png' as icon %}
<img class="os-icon" src="{% static icon %}" /> <img class="os-icon" src="{% static icon %}" />
{% endwith %} {% endwith %}
</a> </a>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{% if clients|has_mobile_clients %} {% if clients|has_mobile_clients %}
{% with clients|of_type:'mobile' as mobile_clients %} {% with clients|of_type:'mobile' as mobile_clients %}
<tr> <tr>
<th rowspan="{{ mobile_clients|length }}"> Mobile </th> <th rowspan="{{ mobile_clients|length }}"> Mobile </th>
{% with mobile_clients|first as client %} {% with mobile_clients|first as client %}
<td> {{ client.name }} </td> <td> {{ client.name }} </td>
<td> <td>
<div class="row"> <div class="row">
{% for platform in client.platforms %} {% for platform in client.platforms %}
{% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %} {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %}
<div class="col-md-2 col-xs-4"> <div class="col-md-2 col-xs-4">
<a href="{{ platform.url }}"> <a href="{{ platform.url }}">
{% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %} {% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %}
<img class="store-icon" src="{% static icon %}" /> <img class="store-icon" src="{% static icon %}" />
{% endwith %} {% endwith %}
</a> </a>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</td> </td>
{% endwith %} {% endwith %}
</tr> </tr>
{% for client in mobile_clients|slice:"1:" %} {% for client in mobile_clients|slice:"1:" %}
<tr> <tr>
<td> {{ client.name }} </td> <td> {{ client.name }} </td>
<td> <td>
<div class="row"> <div class="row">
{% for platform in client.platforms %} {% for platform in client.platforms %}
{% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %} {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %}
<div class="col-md-2 col-xs-4"> <div class="col-md-2 col-xs-4">
<a href="{{ platform.url }}"> <a href="{{ platform.url }}">
{% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %} {% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %}
<img class="store-icon" src="{% static icon %}" /> <img class="store-icon" src="{% static icon %}" />
{% endwith %} {% endwith %}
</a> </a>
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endwith %} {% endwith %}
{% endif %} {% endif %}
</table> {% if clients|has_package_clients %}
{% with clients|of_type:'package' as package_clients %}
<tr>
<th rowspan="{{ package_clients|length }}"> Package </th>
{% with package_clients|first as client %}
<td> {{ client.name }} </td>
<td>
<div class="row">
<ul>
{% for platform in client.platforms %}
{% if platform.type == 'package' and platform.format == 'deb' %}
<li> <strong> Debian: </strong> {{ platform.name }} </li>
{% endif %}
{% if platform.type == 'package' and platform.format == 'homebrew' %}
<li> <strong> HomeBrew: </strong> {{ platform.name }} </li>
{% endif %}
{% endfor %}
</ul>
</div>
</td>
{% endwith %}
</tr>
{% for client in package_clients|slice:"1:" %}
<tr>
<td> {{ client.name }} </td>
<td>
<div class="row">
<ul>
{% for platform in client.platforms %}
{% if platform.type == 'package' %}
{% if platform.type == 'package' and platform.format == 'deb' %}
<li> <strong> Debian: </strong> {{ platform.name }} </li>
{% endif %}
{% if platform.type == 'package' and platform.format == 'homebrew' %}
<li> <strong> HomeBrew: </strong> {{ platform.name }} </li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</div>
</td>
</tr>
{% endfor %}
{% endwith %}
{% endif %}
</table>
{% endif %} {% endif %}

View File

@ -110,12 +110,19 @@ def has_web_clients(clients):
return __check(clients, lambda x: x['type'] == 'web') 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') @register.filter(name='of_type')
def of_type(clients, typ): def of_type(clients, typ):
"""Filter and get clients of a particular type""" """Filter and get clients of a particular type"""
filters = { filters = {
'mobile': has_mobile_clients, 'mobile': has_mobile_clients,
'desktop': has_desktop_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)) return list(filter(filters.get(typ, lambda x: x), clients))