mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-03 20:05:53 +01:00
Allow to see plugins and themes list without internet connection. Also add a more helpful message in the "add" view. re https://github.com/getgrav/grav/issues/1008
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
1. [](#improved)
|
||||
* It is now possible to manually specify a format for the `datetime` field [#1261](https://github.com/getgrav/grav/issues/1261)
|
||||
* Allow to see plugins and themes list without internet connection. Also add a more helpful message in the "add" view [grav#1008](https://github.com/getgrav/grav/issues/1008)
|
||||
1. [](#bugfix)
|
||||
* Fixed issue with downloaded package when installing a testing release
|
||||
|
||||
|
||||
@@ -708,15 +708,21 @@ class Admin
|
||||
return false;
|
||||
}
|
||||
|
||||
return $local
|
||||
? $gpm->getInstalledPlugins()
|
||||
: $gpm->getRepositoryPlugins()->filter(function (
|
||||
$package,
|
||||
$slug
|
||||
) use ($gpm) {
|
||||
return !$gpm->isPluginInstalled($slug);
|
||||
})
|
||||
;
|
||||
if ($local) {
|
||||
return $gpm->getInstalledPlugins();
|
||||
} else {
|
||||
$plugins = $gpm->getRepositoryPlugins();
|
||||
if ($plugins) {
|
||||
return $plugins->filter(function (
|
||||
$package,
|
||||
$slug
|
||||
) use ($gpm) {
|
||||
return !$gpm->isPluginInstalled($slug);
|
||||
});
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -734,11 +740,21 @@ class Admin
|
||||
return false;
|
||||
}
|
||||
|
||||
return $local
|
||||
? $gpm->getInstalledThemes()
|
||||
: $gpm->getRepositoryThemes()->filter(function ($package, $slug) use ($gpm) {
|
||||
return !$gpm->isThemeInstalled($slug);
|
||||
});
|
||||
if ($local) {
|
||||
return $gpm->getInstalledThemes();
|
||||
} else {
|
||||
$themes = $gpm->getRepositoryThemes();
|
||||
if ($themes) {
|
||||
return $themes->filter(function (
|
||||
$package,
|
||||
$slug
|
||||
) use ($gpm) {
|
||||
return !$gpm->isThemeInstalled($slug);
|
||||
});
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -633,3 +633,4 @@ PLUGIN_ADMIN:
|
||||
NEVER_CACHE_TWIG_HELP: "Only cache content and process Twig every time for pages. Ignores twig_first setting."
|
||||
ALLOW_WEBSERVER_GZIP: "Allow WebServer Gzip"
|
||||
ALLOW_WEBSERVER_GZIP_HELP: "Off by default. When enabled, WebServer-configured Gzip/Deflate compression will work, but http connection will not be closed before onShutDown() event causing slower page loading"
|
||||
OFFLINE_WARNING: "The connection to the GPM cannot be established"
|
||||
@@ -17,7 +17,7 @@
|
||||
{% for slug, plugin in admin.plugins(not installing).toArray|ksort %}
|
||||
{% set data = admin.data('plugins/' ~ slug) %}
|
||||
{% set isTestingRelease = admin.gpm.isTestingRelease(slug) %}
|
||||
{% set releaseDate = plugin.date ?: admin.gpm.findPackage(slug).date %}
|
||||
{% set releaseDate = plugin.date ?: admin.gpm.findPackage(slug, true).date %}
|
||||
|
||||
<tr data-gpm-plugin="{{ slug|url_encode }}" data-gpm-name="{{ plugin.name }}" data-gpm-release-date="{{ releaseDate }}" data-gpm-author="{{ plugin.author.name }}" data-gpm-official="{{ admin.isTeamGrav(plugin) ? '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' }}">
|
||||
<td class="gpm-name quadruple">
|
||||
@@ -65,6 +65,8 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td>{{ "PLUGIN_ADMIN.OFFLINE_WARNING"|tu }}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
{% if (installing) %}{% set state = 'installing' %}{% endif %}
|
||||
{% if (config.get('system.pages.theme') == slug) %}{% set state = 'active' %}{% endif %}
|
||||
{% set isTestingRelease = admin.gpm.isTestingRelease(slug) %}
|
||||
{% set releaseDate = theme.date ?: admin.gpm.findPackage(slug).date %}
|
||||
{% 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' }}">
|
||||
<div class="gpm-name">
|
||||
@@ -56,6 +56,8 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<tr><td>{{ "PLUGIN_ADMIN.OFFLINE_WARNING"|tu }}</td></tr>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user