mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
consistent naming convention for icons
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
efa575b204
commit
5165f5a414
@ -1,7 +1,8 @@
|
||||
[style]
|
||||
based_on_style = pep8
|
||||
spaces_before_comment = 2
|
||||
split_before_logical_operator = true
|
||||
split_before_logical_operator = false
|
||||
each_dict_entry_on_separate_line = true
|
||||
coalesce_brackets = false
|
||||
indent_dictionary_value = true
|
||||
indent_dictionary_value = true
|
||||
split_before_named_assigns = false
|
||||
@ -16,6 +16,7 @@
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
|
||||
|
||||
metadata = {
|
||||
'syncthing': {
|
||||
@ -45,21 +46,21 @@ clients = [{
|
||||
.format(metadata['syncthing']['version'])
|
||||
}, {
|
||||
'type': 'download',
|
||||
'os': 'GNU/Linux',
|
||||
'os': Desktop_OS.GNU_LINUX.value,
|
||||
'arch': 'amd64',
|
||||
'url': 'https://github.com/syncthing/syncthing/releases/'
|
||||
'download/v{0}/syncthing-linux-amd64-v{0}.tar.gz'
|
||||
.format(metadata['syncthing']['version']),
|
||||
}, {
|
||||
'type': 'download',
|
||||
'os': 'macOS',
|
||||
'os': Desktop_OS.MAC_OS.value,
|
||||
'arch': 'amd64',
|
||||
'url': 'https://github.com/syncthing/syncthing/releases/'
|
||||
'download/v{0}/syncthing-macosx-amd64-v{0}.tar.gz'
|
||||
.format(metadata['syncthing']['version']),
|
||||
}, {
|
||||
'type': 'download',
|
||||
'os': 'Windows',
|
||||
'os': Desktop_OS.WINDOWS.value,
|
||||
'arch': 'amd64',
|
||||
'url': 'https://github.com/syncthing/syncthing/releases/'
|
||||
'download/v{0}/syncthing-windows-amd64-v{0}.zip'
|
||||
@ -68,9 +69,9 @@ clients = [{
|
||||
'type':
|
||||
'store',
|
||||
'os':
|
||||
'Android',
|
||||
Mobile_OS.ANDROID.value,
|
||||
'store_name':
|
||||
'google_play_store',
|
||||
Store.GOOGLE_PLAY.value,
|
||||
'fully_qualified_name':
|
||||
'com.nutomic.syncthingandroid',
|
||||
'url':
|
||||
@ -80,9 +81,9 @@ clients = [{
|
||||
'type':
|
||||
'store',
|
||||
'os':
|
||||
'Android',
|
||||
Mobile_OS.ANDROID.value,
|
||||
'store_name':
|
||||
'fdroid_store',
|
||||
Store.F_DROID.value,
|
||||
'fully_qualified_name':
|
||||
'com.nutomic.syncthingandroid',
|
||||
'url':
|
||||
|
||||
@ -60,50 +60,39 @@
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'download' %}
|
||||
<div class="col-md-1 col-xs-2">
|
||||
<a href="{{ platform.url }}">
|
||||
{% if platform.os == 'Windows' %}
|
||||
<img class="os-icon" src="{% static 'theme/icons/windows.png' %}" />
|
||||
{% elif platform.os == 'macOS' %}
|
||||
<img class="os-icon" src="{% static 'theme/icons/apple.png' %}" />
|
||||
{% elif platform.os == 'GNU/Linux' %}
|
||||
<img class="os-icon" src="{% static 'theme/icons/gnu-linux.png' %}" />
|
||||
{% endif %}
|
||||
</a>
|
||||
<a href="{{ platform.url }}">
|
||||
{% with 'theme/icons/'|add:platform.os|add:'.png' as icon %}
|
||||
<img class="os-icon" src="{% static icon %}" />
|
||||
{% endwith %}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if clients|has_mobile_clients %}
|
||||
<div class="clients-info">
|
||||
{% load static %}
|
||||
<p class="heading">{% trans "Mobile Clients" %}:</p>
|
||||
{% load static %}
|
||||
<p class="heading">{% trans "Mobile Clients" %}:</p>
|
||||
<ul>
|
||||
{% for client in clients %}
|
||||
{% if client|has_mobile_clients %}
|
||||
{% for client in clients %}
|
||||
{% if client|has_mobile_clients %}
|
||||
<li class="col-md-12 col-xs-12"><span>{{ client.name }}</span></li>
|
||||
<div class="row">
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'store' and platform.os == 'Android' %}
|
||||
{% if platform.store_name == 'fdroid_store' %}
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'store' and platform.os == 'android' %}
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<a href="{{ platform.url }}">
|
||||
<img class="store-icon" src="{% static 'theme/icons/f-droid.png' %}"/>
|
||||
<a href="{{ platform.url }}">
|
||||
{% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %}
|
||||
<img class="os-icon" src="{% static icon %}" />
|
||||
{% endwith %}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if platform.store_name == 'google_play_store' %}
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<a href="{{ platform.url }}">
|
||||
<img class="store-icon" src="{% static 'theme/icons/google-play.png' %}"/>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
@ -17,10 +17,27 @@
|
||||
|
||||
import os
|
||||
from django import template
|
||||
from enum import Enum
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
class Desktop_OS(Enum):
|
||||
WINDOWS = 'windows'
|
||||
MAC_OS = 'mac-os'
|
||||
GNU_LINUX = 'gnu-linux'
|
||||
|
||||
|
||||
class Mobile_OS(Enum):
|
||||
ANDROID = 'android'
|
||||
IOS = 'ios'
|
||||
|
||||
|
||||
class Store(Enum):
|
||||
GOOGLE_PLAY = 'google-play'
|
||||
F_DROID = 'f-droid'
|
||||
|
||||
|
||||
def mark_active_menuitem(menu, path):
|
||||
"""Mark the best-matching menu item with 'active'
|
||||
|
||||
@ -76,7 +93,8 @@ def has_web_clients(clients):
|
||||
@register.filter(name='has_mobile_clients')
|
||||
def has_mobile_clients(clients):
|
||||
"""Filter to find out whether an application has mobile clients"""
|
||||
return __check(clients, lambda x: x.get('os', '') == 'Android')
|
||||
return __check(clients,
|
||||
lambda x: x.get('os', '') == Mobile_OS.ANDROID.value)
|
||||
|
||||
|
||||
@register.filter(name='has_desktop_clients')
|
||||
@ -84,4 +102,4 @@ def has_desktop_clients(clients):
|
||||
"""Filter to find out whether an application has desktop clients"""
|
||||
return __check(
|
||||
clients,
|
||||
lambda x: x.get('os', '') in ['Windows', 'macOS', 'GNU/Linux'])
|
||||
lambda x: x.get('os', '') in [x.value for x in list(Desktop_OS)])
|
||||
|
||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Loading…
x
Reference in New Issue
Block a user