wiki-grav/plugins/admin/themes/grav/templates/themes.html.twig

88 lines
3.3 KiB
Twig
Raw Normal View History

{% extends 'partials/base.html.twig' %}
{% if admin.route %}
{% set installing = admin.route starts with 'install' %}
{% if installing %}
{% set title = "PLUGIN_ADMIN.THEMES"|t %}
{% else %}
{% set installed = true %}
{# Try installed packages first, then remote #}
{% set package = admin.themes(true)[admin.route] %}
{% if (not package) %}
{% set package = admin.themes(false)[admin.route] %}
{% set installed = false %}
{% endif %}
{% set theme = package.toArray() %}
{% set state = config.get('system.pages.theme') == theme.slug ? 'active' : 'inactive' %}
{% set title = "PLUGIN_ADMIN.THEME"|t ~ ": " ~ theme.name %}
{% endif %}
{% else %}
{% set title = "PLUGIN_ADMIN.THEMES"|t %}
{% endif %}
{% if admin.route or installing %}
{% block stylesheets %}
{% do assets.addCss(theme_url~'/css/codemirror/codemirror.css') %}
{{ parent() }}
{% endblock %}
{% block javascripts %}
{{ parent() }}
{% endblock %}
{% endif %}
{% block titlebar %}
{% if not admin.route or installing %}
<div class="button-bar">
{% if (installing) %}
<a class="button" href="{{ admin_route('/themes') }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|t }}</a>
{% else %}
<a class="button" href="{{ admin_route('/') }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|t }}</a>
<a class="button" href="{{ admin_route('/themes/install') }}"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|t }}</a>
{% if authorize(['admin.maintenance', 'admin.super']) %}
<button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|t }}</button>
{% endif %}
{% endif %}
</div>
<h1><i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEMES"|t }}</h1>
{% else %}
{% if (installed) %}
<div class="button-bar">
<a class="button" href="{{ admin_route('/themes') }}"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_THEMES"|t }}</a>
{% if state == 'active' %}
<button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|t }}</button>
{% endif %}
</div>
{% else %}
<div class="button-bar">
<a class="button" href="{{ admin_route('/themes/install') }}"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_THEMES"|t }}</a>
</div>
{% endif %}
<h1><i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEME"|t }}: {{ theme.name }}</h1>
{% endif %}
{% endblock %}
{% block messages %}
{{ parent() }}
{% if config.plugins.admin.notifications.themes %}
<div class="themes-notifications-container hidden"></div>
{% endif %}
{% endblock %}
{% block content %}
<div class="gpm gpm-themes">
{% if not admin.route or installing %}
{% include 'partials/themes-list.html.twig' %}
{% else %}
{% if theme is null %}
{{redirect_me(base_url_relative ~ '/404')}}
{% endif %}
{% include 'partials/themes-details.html.twig' %}
{% endif %}
</div>
{% endblock %}