mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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]
|
[style]
|
||||||
based_on_style = pep8
|
based_on_style = pep8
|
||||||
spaces_before_comment = 2
|
spaces_before_comment = 2
|
||||||
split_before_logical_operator = true
|
split_before_logical_operator = false
|
||||||
each_dict_entry_on_separate_line = true
|
each_dict_entry_on_separate_line = true
|
||||||
coalesce_brackets = false
|
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 django.utils.translation import ugettext_lazy as _
|
||||||
|
from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store
|
||||||
|
|
||||||
metadata = {
|
metadata = {
|
||||||
'syncthing': {
|
'syncthing': {
|
||||||
@ -45,21 +46,21 @@ clients = [{
|
|||||||
.format(metadata['syncthing']['version'])
|
.format(metadata['syncthing']['version'])
|
||||||
}, {
|
}, {
|
||||||
'type': 'download',
|
'type': 'download',
|
||||||
'os': 'GNU/Linux',
|
'os': Desktop_OS.GNU_LINUX.value,
|
||||||
'arch': 'amd64',
|
'arch': 'amd64',
|
||||||
'url': 'https://github.com/syncthing/syncthing/releases/'
|
'url': 'https://github.com/syncthing/syncthing/releases/'
|
||||||
'download/v{0}/syncthing-linux-amd64-v{0}.tar.gz'
|
'download/v{0}/syncthing-linux-amd64-v{0}.tar.gz'
|
||||||
.format(metadata['syncthing']['version']),
|
.format(metadata['syncthing']['version']),
|
||||||
}, {
|
}, {
|
||||||
'type': 'download',
|
'type': 'download',
|
||||||
'os': 'macOS',
|
'os': Desktop_OS.MAC_OS.value,
|
||||||
'arch': 'amd64',
|
'arch': 'amd64',
|
||||||
'url': 'https://github.com/syncthing/syncthing/releases/'
|
'url': 'https://github.com/syncthing/syncthing/releases/'
|
||||||
'download/v{0}/syncthing-macosx-amd64-v{0}.tar.gz'
|
'download/v{0}/syncthing-macosx-amd64-v{0}.tar.gz'
|
||||||
.format(metadata['syncthing']['version']),
|
.format(metadata['syncthing']['version']),
|
||||||
}, {
|
}, {
|
||||||
'type': 'download',
|
'type': 'download',
|
||||||
'os': 'Windows',
|
'os': Desktop_OS.WINDOWS.value,
|
||||||
'arch': 'amd64',
|
'arch': 'amd64',
|
||||||
'url': 'https://github.com/syncthing/syncthing/releases/'
|
'url': 'https://github.com/syncthing/syncthing/releases/'
|
||||||
'download/v{0}/syncthing-windows-amd64-v{0}.zip'
|
'download/v{0}/syncthing-windows-amd64-v{0}.zip'
|
||||||
@ -68,9 +69,9 @@ clients = [{
|
|||||||
'type':
|
'type':
|
||||||
'store',
|
'store',
|
||||||
'os':
|
'os':
|
||||||
'Android',
|
Mobile_OS.ANDROID.value,
|
||||||
'store_name':
|
'store_name':
|
||||||
'google_play_store',
|
Store.GOOGLE_PLAY.value,
|
||||||
'fully_qualified_name':
|
'fully_qualified_name':
|
||||||
'com.nutomic.syncthingandroid',
|
'com.nutomic.syncthingandroid',
|
||||||
'url':
|
'url':
|
||||||
@ -80,9 +81,9 @@ clients = [{
|
|||||||
'type':
|
'type':
|
||||||
'store',
|
'store',
|
||||||
'os':
|
'os':
|
||||||
'Android',
|
Mobile_OS.ANDROID.value,
|
||||||
'store_name':
|
'store_name':
|
||||||
'fdroid_store',
|
Store.F_DROID.value,
|
||||||
'fully_qualified_name':
|
'fully_qualified_name':
|
||||||
'com.nutomic.syncthingandroid',
|
'com.nutomic.syncthingandroid',
|
||||||
'url':
|
'url':
|
||||||
|
|||||||
@ -60,50 +60,39 @@
|
|||||||
{% for platform in client.platforms %}
|
{% for platform in client.platforms %}
|
||||||
{% if platform.type == 'download' %}
|
{% if platform.type == 'download' %}
|
||||||
<div class="col-md-1 col-xs-2">
|
<div class="col-md-1 col-xs-2">
|
||||||
<a href="{{ platform.url }}">
|
<a href="{{ platform.url }}">
|
||||||
{% if platform.os == 'Windows' %}
|
{% with 'theme/icons/'|add:platform.os|add:'.png' as icon %}
|
||||||
<img class="os-icon" src="{% static 'theme/icons/windows.png' %}" />
|
<img class="os-icon" src="{% static icon %}" />
|
||||||
{% elif platform.os == 'macOS' %}
|
{% endwith %}
|
||||||
<img class="os-icon" src="{% static 'theme/icons/apple.png' %}" />
|
</a>
|
||||||
{% elif platform.os == 'GNU/Linux' %}
|
|
||||||
<img class="os-icon" src="{% static 'theme/icons/gnu-linux.png' %}" />
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if clients|has_mobile_clients %}
|
{% if clients|has_mobile_clients %}
|
||||||
<div class="clients-info">
|
<div class="clients-info">
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<p class="heading">{% trans "Mobile Clients" %}:</p>
|
<p class="heading">{% trans "Mobile Clients" %}:</p>
|
||||||
<ul>
|
<ul>
|
||||||
{% for client in clients %}
|
{% for client in clients %}
|
||||||
{% if client|has_mobile_clients %}
|
{% if client|has_mobile_clients %}
|
||||||
<li class="col-md-12 col-xs-12"><span>{{ client.name }}</span></li>
|
<li class="col-md-12 col-xs-12"><span>{{ client.name }}</span></li>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for platform in client.platforms %}
|
{% for platform in client.platforms %}
|
||||||
{% if platform.type == 'store' and platform.os == 'Android' %}
|
{% if platform.type == 'store' and platform.os == 'android' %}
|
||||||
{% if platform.store_name == 'fdroid_store' %}
|
|
||||||
<div class="col-md-2 col-xs-4">
|
<div class="col-md-2 col-xs-4">
|
||||||
<a href="{{ platform.url }}">
|
<a href="{{ platform.url }}">
|
||||||
<img class="store-icon" src="{% static 'theme/icons/f-droid.png' %}"/>
|
{% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %}
|
||||||
|
<img class="os-icon" src="{% static icon %}" />
|
||||||
|
{% endwith %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -17,10 +17,27 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from django import template
|
from django import template
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
register = template.Library()
|
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):
|
def mark_active_menuitem(menu, path):
|
||||||
"""Mark the best-matching menu item with 'active'
|
"""Mark the best-matching menu item with 'active'
|
||||||
|
|
||||||
@ -76,7 +93,8 @@ def has_web_clients(clients):
|
|||||||
@register.filter(name='has_mobile_clients')
|
@register.filter(name='has_mobile_clients')
|
||||||
def has_mobile_clients(clients):
|
def has_mobile_clients(clients):
|
||||||
"""Filter to find out whether an application has mobile 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')
|
@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"""
|
"""Filter to find out whether an application has desktop clients"""
|
||||||
return __check(
|
return __check(
|
||||||
clients,
|
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