mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
clients: Improve code readability
- Break up long lines multiple short lines - Fix indentation and formatting Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
parent
8e3bbdb089
commit
95709518eb
@ -45,19 +45,20 @@
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if clients|length == 1 and clients|first|lookup:'platforms'|length == 1 and clients|first|lookup:'platforms'|first|lookup:'type' == 'web' %}
|
||||
|
||||
{% block launch_button %}
|
||||
<p>
|
||||
<a href='{{ clients|first|lookup:"platforms"|first|lookup:"url" }}' target='_blank' class='btn btn-primary'>
|
||||
{% trans "Launch web client" %}</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% if clients|length == 1 %}
|
||||
{% with clients|first|lookup:'platforms' as platforms %}
|
||||
{% if platforms|length == 1 and platforms|first|lookup:'type' == 'web' %}
|
||||
{% block launch_button %}
|
||||
<p>
|
||||
<a href='{{ platforms|first|lookup:"url" }}'
|
||||
target='_blank' class='btn btn-primary'>
|
||||
{% trans "Launch web client" %}</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
|
||||
{% include "clients.html" with clients=clients enabled=is_enabled %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% block subsubmenu %}
|
||||
|
||||
@ -31,122 +31,122 @@
|
||||
</p>
|
||||
|
||||
<div id="clients" class="collapse">
|
||||
<table id="clients" class="table table-striped">
|
||||
<table id="clients" class="table table-striped">
|
||||
|
||||
{% with clients|clients_of_type:'web' as web_clients %}
|
||||
{% for client in web_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ web_clients|length }}">{% trans "Web" %}</th>
|
||||
{% endif %}
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'web' %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
<a target="_blank" rel="noopener noreferrer"
|
||||
class="btn btn-default" role="button"
|
||||
{% if not enabled %} disabled="disabled"
|
||||
{% else %} href="{{ platform.url }}"
|
||||
{% endif %}>
|
||||
{% trans "Launch" %}
|
||||
<span class="fa fa-external-link"></span>
|
||||
</a>
|
||||
</td>
|
||||
{% with clients|clients_of_type:'web' as web_clients %}
|
||||
{% for client in web_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ web_clients|length }}">{% trans "Web" %}</th>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
{% with clients|clients_of_type:'desktop' as desktop_clients %}
|
||||
{% for client in desktop_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ desktop_clients|length }}">{% trans "Desktop" %}</th>
|
||||
{% endif %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'download' %}
|
||||
<a class="btn btn-default" href="{{ platform.url }}" role="button">
|
||||
<span>
|
||||
{% with 'theme/icons/'|add:platform.os|add:'.png' as icon %}
|
||||
<img class="client-icon" src="{% static icon %}" />
|
||||
{% if platform.os == 'gnu-linux' %}
|
||||
{% trans 'GNU/Linux' %}
|
||||
{% elif platform.os == 'windows' %}
|
||||
{% trans 'Windows' %}
|
||||
{% elif platform.os == 'macos' %}
|
||||
{% trans 'macOS' %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</span>
|
||||
</a>
|
||||
{% if platform.type == 'web' %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
<a target="_blank" rel="noopener noreferrer"
|
||||
class="btn btn-default" role="button"
|
||||
{% if not enabled %} disabled="disabled"
|
||||
{% else %} href="{{ platform.url }}"
|
||||
{% endif %}>
|
||||
{% trans "Launch" %}
|
||||
<span class="fa fa-external-link"></span>
|
||||
</a>
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
{% with clients|clients_of_type:'mobile' as mobile_clients %}
|
||||
{% for client in mobile_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ mobile_clients|length }}">{% trans "Mobile" %}</th>
|
||||
{% endif %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %}
|
||||
<a class="btn btn-default" href="{{ platform.url }}" role="button">
|
||||
<span>
|
||||
{% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %}
|
||||
<img class="client-icon" src="{% static icon %}" />
|
||||
{% if platform.store_name == 'google-play' %}
|
||||
{% trans 'Play Store' %}
|
||||
{% elif platform.store_name == 'f-droid' %}
|
||||
{% trans 'F-Droid' %}
|
||||
{% elif platform.store_name == 'app-store' %}
|
||||
{% trans 'App Store' %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% with clients|clients_of_type:'desktop' as desktop_clients %}
|
||||
{% for client in desktop_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ desktop_clients|length }}">{% trans "Desktop" %}</th>
|
||||
{% endif %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'download' %}
|
||||
<a class="btn btn-default" href="{{ platform.url }}" role="button">
|
||||
<span>
|
||||
{% with 'theme/icons/'|add:platform.os|add:'.png' as icon %}
|
||||
<img class="client-icon" src="{% static icon %}" />
|
||||
{% if platform.os == 'gnu-linux' %}
|
||||
{% trans 'GNU/Linux' %}
|
||||
{% elif platform.os == 'windows' %}
|
||||
{% trans 'Windows' %}
|
||||
{% elif platform.os == 'macos' %}
|
||||
{% trans 'macOS' %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
{% with clients|clients_of_type:'package' as package_clients %}
|
||||
{% for client in package_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ package_clients|length }}">{% trans "Package" %}</th>
|
||||
{% endif %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'package' %}
|
||||
{% if platform.format == 'deb' %}
|
||||
<div><strong>{% trans "Debian:" %}</strong> {{ platform.name }}</div>
|
||||
{% with clients|clients_of_type:'mobile' as mobile_clients %}
|
||||
{% for client in mobile_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ mobile_clients|length }}">{% trans "Mobile" %}</th>
|
||||
{% endif %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %}
|
||||
<a class="btn btn-default" href="{{ platform.url }}" role="button">
|
||||
<span>
|
||||
{% with 'theme/icons/'|add:platform.store_name|add:'.png' as icon %}
|
||||
<img class="client-icon" src="{% static icon %}" />
|
||||
{% if platform.store_name == 'google-play' %}
|
||||
{% trans 'Play Store' %}
|
||||
{% elif platform.store_name == 'f-droid' %}
|
||||
{% trans 'F-Droid' %}
|
||||
{% elif platform.store_name == 'app-store' %}
|
||||
{% trans 'App Store' %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if platform.format == 'brew' %}
|
||||
<div><strong>{% trans "Homebrew:" %}</strong> {{ platform.name }}</div>
|
||||
{% endif %}
|
||||
{% if platform.format == 'rpm' %}
|
||||
<p><strong>{% trans "RPM:" %}</strong> {{ platform.name }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
</table>
|
||||
{% with clients|clients_of_type:'package' as package_clients %}
|
||||
{% for client in package_clients %}
|
||||
<tr>
|
||||
{% if forloop.counter == 1 %}
|
||||
<th rowspan="{{ package_clients|length }}">{% trans "Package" %}</th>
|
||||
{% endif %}
|
||||
<td>{{ client.name }}</td>
|
||||
<td>
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'package' %}
|
||||
{% if platform.format == 'deb' %}
|
||||
<div><strong>{% trans "Debian:" %}</strong> {{ platform.name }}</div>
|
||||
{% endif %}
|
||||
{% if platform.format == 'brew' %}
|
||||
<div><strong>{% trans "Homebrew:" %}</strong> {{ platform.name }}</div>
|
||||
{% endif %}
|
||||
{% if platform.format == 'rpm' %}
|
||||
<p><strong>{% trans "RPM:" %}</strong> {{ platform.name }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user