mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-27 16:26:32 +01:00
improve activation logic
This commit is contained in:
@@ -700,6 +700,8 @@ class AdminController extends AdminBaseController
|
||||
|
||||
Cache::clearCache('invalidate');
|
||||
|
||||
$this->post = ['_redirect' => 'themes/' . $name ];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
16
themes/grav/templates/partials/modal-switch-theme.html.twig
Normal file
16
themes/grav/templates/partials/modal-switch-theme.html.twig
Normal file
@@ -0,0 +1,16 @@
|
||||
<div class="remodal theme-switcher" data-remodal-id="theme-switch-warn" data-remodal-options="hashTracking: false">
|
||||
<form>
|
||||
<h1>{{ "PLUGIN_ADMIN.SWITCHING_TO"|tu }} <strong>{theme_name}</strong></h1>
|
||||
<p class="bigger">
|
||||
{{ "PLUGIN_ADMIN.SWITCHING_TO_DESCRIPTION"|tu }}
|
||||
</p>
|
||||
<p class="bigger">
|
||||
{{ "PLUGIN_ADMIN.SWITCHING_TO_CONFIRMATION"|tu }} <strong>{theme_name}</strong>?
|
||||
</p>
|
||||
<br>
|
||||
<div class="button-bar">
|
||||
<button data-remodal-action="cancel" class="button secondary remodal-cancel"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CANCEL"|tu }}</button>
|
||||
<a class="button continue" href="#"><i class="fa fa-fw fa-check"></i>{{ "PLUGIN_ADMIN.CONTINUE"|tu }}</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -3,6 +3,9 @@
|
||||
{% set isTestingRelease = gpm.isTestingRelease(theme.slug) %}
|
||||
{% set gumroad_loaded = false %}
|
||||
|
||||
{% set state = 'inactive' %}
|
||||
{% if (config.get('system.pages.theme') == theme.slug) %}{% set state = 'active' %}{% endif %}
|
||||
|
||||
<div class="grav-update theme" data-gpm-theme="{{ admin.route }}">
|
||||
</div>
|
||||
|
||||
@@ -107,6 +110,7 @@
|
||||
</div>
|
||||
|
||||
{% if (installed) %}
|
||||
{% if (state == 'active') %}
|
||||
{% set data = admin.data('themes/' ~ admin.route) %}
|
||||
{% include 'partials/blueprints.html.twig' with { data: data, blueprints: data.blueprints } %}
|
||||
|
||||
@@ -119,6 +123,23 @@
|
||||
<a class="button" href="#" data-remodal-target="remove-package"><i class="fa fa-fw fa-warning"></i> {{ "PLUGIN_ADMIN.REMOVE_THEME"|tu }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="theme" data-gpm-theme="{{ theme.slug }}" data-gpm-name="{{ theme.name }}">
|
||||
<div style="display:none;" class="gpm-name"><a>{{ theme.name }}</a></div>
|
||||
<form>
|
||||
<div class="form-field grid">
|
||||
<div class="form-label block size-1-3">
|
||||
<label>Activation required to configure</label>
|
||||
</div>
|
||||
<div class="form-data block size-2-3">
|
||||
<a class="button" data-remodal-target="theme-switch-warn" href="{{ uri.addNonce(base_url_relative ~ '/themes/' ~ theme.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"|tu }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="button-bar success">
|
||||
{% if (theme.premium and not admin.license(theme.slug)) %}
|
||||
@@ -133,6 +154,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include 'partials/modal-switch-theme.html.twig' with {theme_name: theme.name} %}
|
||||
{% include 'partials/modal-changes-detected.html.twig' %}
|
||||
{% include 'partials/modal-add-package.html.twig' with { type: 'theme' } %}
|
||||
{% include 'partials/modal-update-packages.html.twig' with { type: 'theme' } %}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</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">
|
||||
{{ "PLUGIN_ADMIN.ACTIVATE"|tu }}
|
||||
<i class="fa fa-power-off" aria-hidden="true"></i> {{ "PLUGIN_ADMIN.ACTIVATE"|tu }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -75,22 +75,6 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="remodal theme-switcher" data-remodal-id="theme-switch-warn" data-remodal-options="hashTracking: false">
|
||||
<form>
|
||||
<h1>{{ "PLUGIN_ADMIN.SWITCHING_TO"|tu }} <strong>{theme_name}</strong></h1>
|
||||
<p class="bigger">
|
||||
{{ "PLUGIN_ADMIN.SWITCHING_TO_DESCRIPTION"|tu }}
|
||||
</p>
|
||||
<p class="bigger">
|
||||
{{ "PLUGIN_ADMIN.SWITCHING_TO_CONFIRMATION"|tu }} <strong>{theme_name}</strong>?
|
||||
</p>
|
||||
<br>
|
||||
<div class="button-bar">
|
||||
<button data-remodal-action="cancel" class="button secondary remodal-cancel"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CANCEL"|tu }}</button>
|
||||
<a class="button continue" href="#"><i class="fa fa-fw fa-check"></i>{{ "PLUGIN_ADMIN.CONTINUE"|tu }}</a>
|
||||
</div>
|
||||
</form>
|
||||
</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' } %}
|
||||
|
||||
Reference in New Issue
Block a user