FreedomBox/plinth/templates/toolbar.html
Alice Kile 52f6da2a41
templates: Add toolbar for apps in app.html
Changes to the app.html layout, mainly:

- A new panel is created to hold action buttons. Closes #1698.

- Launch button is now shown in the panel alongside "Client Apps".

- Run Diagnostics button is moved into this panel as well. Closes #1690.

- Disable 'Launch web client' button when app is disabled. Closes #1718.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-12-01 16:40:13 -05:00

96 lines
3.2 KiB
HTML

{% comment %}
#
# This file is part of FreedomBox.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load plinth_extras %}
{% load static %}
{% block toolbar %}
{% if clients %}
<div class="toolbar toolbar-default">
<div class="toolbar-heading">
<section class="toolbar-title">
{% if clients|get_self_hosted_web_apps|length == 1 and clients|length == 1 %}
<a
{% if enabled %}
href='{{ clients|get_self_hosted_web_apps|first|lookup:"url" }}'
{% endif %}
target='_blank'
>
<button
role="button"
type="button"
class="btn btn-primary"
{% if not enabled %}
disabled="disabled"
{% endif %}
>
{% trans "Launch web client" %}
</button>
</a>
{% elif clients|get_self_hosted_web_apps|length == 1 %}
<button type="button" class="btn btn-default collapsed collapsible-button"
data-toggle="collapse" data-target="#clients">
<span class="fa fa-chevron-right fa-fw" aria-hidden="true"></span>
{% trans "Client Apps" %}
</button>
<a
{% if enabled %}
href='{{ clients|get_self_hosted_web_apps|first|lookup:"url" }}'
{% endif %}
target='_blank'
>
<button
role="button"
type="button"
class="btn btn-primary"
{% if not enabled %}
disabled="disabled"
{% endif %}
>
{% trans "Launch web client" %}
</button>
</a>
{% else %}
<button type="button" class="btn btn-default collapsed collapsible-button"
data-toggle="collapse" data-target="#clients">
<span class="fa fa-chevron-right fa-fw" aria-hidden="true"></span>
{% trans "Client Apps" %}
</button>
{% endif %}
{% block diagnostics %}
{% if diagnostics_module_name %}
{% include "diagnostics_button.html" with module=diagnostics_module_name enabled=is_enabled %}
{% endif %}
{% endblock %}
</section>
</div>
<div class="toolbar-body">
{% include "clients.html" with clients=clients enabled=is_enabled %}
</div>
</div>
{% endif %}
{% endblock toolbar %}