news/plugins/admin/themes/grav/templates/partials/themes-list.html.twig

81 lines
4.9 KiB
Twig

{% set gumroad_loaded = false %}
<div class="grav-update themes"></div>
{% if installing %}
{% include 'partials/release-toggle.html.twig' %}
{% endif %}
{% include 'partials/list-sort.html.twig' with { list_view: 'themes' } %}
<h1>
{{ installing ? "PLUGIN_ADMIN.AVAILABLE_THEMES"|t : "PLUGIN_ADMIN.INSTALLED_THEMES"|t }}
</h1>
<form>
<div class="gpm-search">
<input type="text" placeholder="{{ "PLUGIN_ADMIN.RESOURCE_FILTER"|t }}" data-gpm-filter>
</div>
</form>
<div class="themes card-row grid fixed-blocks pure-g">
{% for slug, theme in admin.themes(not installing).toArray|ksort %}
{% set state = 'inactive' %}
{% if (installing) %}{% set state = 'installing' %}{% endif %}
{% if (config.get('system.pages.theme') == slug) %}{% set state = 'active' %}{% endif %}
{% set isTestingRelease = admin.gpm.isTestingRelease(slug) %}
{% set isPremium = admin.isPremiumProduct(theme) %}
{% set releaseDate = theme.date ?: admin.gpm.findPackage(slug, true).date %}
<div class="theme card-item pure-u-1-3 {{ state }}-theme" data-gpm-theme="{{ slug|url_encode }}" data-gpm-name="{{ theme.name }}" data-gpm-release-date="{{ releaseDate }}" data-gpm-author="{{ theme.author.name }}" data-gpm-official="{{ admin.isTeamGrav(theme) ? '1' : '2' }}" data-gpm-updatable="{{ admin.gpm.isUpdatable(slug) ? '1' : '2' }}" data-gpm-enabled="{{ data.get('enabled') ? '1' : '2' }}" data-gpm-testing="{{ isTestingRelease ? '1' : '2' }}" data-gpm-premium="{{ isPremium ? '1' : '2' }}">
<div class="gpm-name">
<i class="fa fa-fw fa-{{ theme.icon }}"></i>
<a href="{{ admin_route('/themes/' ~ slug|url_encode) }}">{{ theme.name }}</a>
{% if admin.isTeamGrav(theme) %}
<small><span class="info-reverse"><i class="fa fa-check-circle" title="{{ "PLUGIN_ADMIN.GRAV_OFFICIAL_THEME"|t }}"></i></span></small>
{% endif %}
{% if isPremium %}
{% if not gumroad_loaded %}
{% set gumroad_loaded = true %}
<script src="//gumroad.com/js/gumroad.js"></script>
{% endif %}
<small><span class="badge warning premium"><i class="fa fa-star-o"></i> {{ "PLUGIN_ADMIN.PREMIUM_PRODUCT"|t }}</span></small>
{% endif %}
{% if theme.symlink %}
<span class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.THEME_SYMBOLICALLY_LINKED"|t }}">
<i class="fa fa-fw fa-link"></i>
</span>
{% endif %}
<span class="gpm-version">v{{ theme.version }}</span>
{% if isTestingRelease %}<span class="gpm-testing">test release</span>{% endif %}
</div>
<div class="gpm-screenshot">
{% set thumb = installing ? '//getgrav.org/images/' ~ theme.screenshot : theme.thumbnail %}
<a href="{{ admin_route('/themes/' ~ slug|url_encode) }}"><img src="{{ thumb }}" /></a>
</div>
{% if (state == 'installing') %}
<div class="gpm-actions">
{% if (theme.premium and not admin.license(theme.slug)) %}
{% if not gumroad_loaded %}
{% set gumroad_loaded = true %}
<script src="//gumroad.com/js/gumroad.js"></script>
{% endif %}
<a class="gumroad-button button" href="https://gum.co/{{ theme.premium.permalink }}" target="_blank" data-gumroad-single-product="true"><i class="fa fa-shopping-cart"></i> {{ theme.premium.button|default('Purchase') }}</a>
{% else %}
<a class="button" href="#" data-remodal-target="add-package" data-packages-slugs="{{ slug }}" data-theme-action="start-package-installation"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.INSTALL"|t }}</a>
{% endif %}
</div>
{% elseif state == 'active' %}
<div class="gpm-actions">
<i class="fa fa-star"></i> {{ "PLUGIN_ADMIN.ACTIVE_THEME"|t }}
</div>
{% else %}
<a data-remodal-target="theme-switch-warn" href="{{ uri.addNonce(base_url_relative ~ '/themes/' ~ slug ~ '/task' ~ config.system.param_sep ~ 'activate', 'admin-form', 'admin-nonce') }}" class="gpm-actions">
<i class="fa fa-power-off" aria-hidden="true"></i> {{ "PLUGIN_ADMIN.ACTIVATE"|t }}
</a>
{% endif %}
</div>
{% else %}
<tr><td>{{ "PLUGIN_ADMIN.OFFLINE_WARNING"|t }}</td></tr>
{% endfor %}
</div>
{% include 'partials/modal-switch-theme.html.twig' %}
{% include 'partials/modal-add-package.html.twig' with { type: 'theme' } %}
{% include 'partials/modal-update-packages.html.twig' with { type: 'theme' } %}