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:
Flavio Copes
2017-01-22 15:50:37 +01:00
parent d6afa39624
commit 2c58db3418
5 changed files with 40 additions and 18 deletions

View File

@@ -3,9 +3,10 @@
1. [](#improved) 1. [](#improved)
* It is now possible to manually specify a format for the `datetime` field [#1261](https://github.com/getgrav/grav/issues/1261) * 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) 1. [](#bugfix)
* Fixed issue with downloaded package when installing a testing release * Fixed issue with downloaded package when installing a testing release
# v1.2.9 # v1.2.9
## 01/18/2017 ## 01/18/2017

View File

@@ -708,15 +708,21 @@ class Admin
return false; return false;
} }
return $local if ($local) {
? $gpm->getInstalledPlugins() return $gpm->getInstalledPlugins();
: $gpm->getRepositoryPlugins()->filter(function ( } else {
$package, $plugins = $gpm->getRepositoryPlugins();
$slug if ($plugins) {
) use ($gpm) { return $plugins->filter(function (
return !$gpm->isPluginInstalled($slug); $package,
}) $slug
; ) use ($gpm) {
return !$gpm->isPluginInstalled($slug);
});
} else {
return [];
}
}
} }
/** /**
@@ -734,11 +740,21 @@ class Admin
return false; return false;
} }
return $local if ($local) {
? $gpm->getInstalledThemes() return $gpm->getInstalledThemes();
: $gpm->getRepositoryThemes()->filter(function ($package, $slug) use ($gpm) { } else {
return !$gpm->isThemeInstalled($slug); $themes = $gpm->getRepositoryThemes();
}); if ($themes) {
return $themes->filter(function (
$package,
$slug
) use ($gpm) {
return !$gpm->isThemeInstalled($slug);
});
} else {
return [];
}
}
} }
/** /**

View File

@@ -632,4 +632,5 @@ PLUGIN_ADMIN:
NEVER_CACHE_TWIG: "Never Cache Twig" NEVER_CACHE_TWIG: "Never Cache Twig"
NEVER_CACHE_TWIG_HELP: "Only cache content and process Twig every time for pages. Ignores twig_first setting." 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: "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" 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"

View File

@@ -17,7 +17,7 @@
{% for slug, plugin in admin.plugins(not installing).toArray|ksort %} {% for slug, plugin in admin.plugins(not installing).toArray|ksort %}
{% set data = admin.data('plugins/' ~ slug) %} {% set data = admin.data('plugins/' ~ slug) %}
{% set isTestingRelease = admin.gpm.isTestingRelease(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' }}"> <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"> <td class="gpm-name quadruple">
@@ -65,6 +65,8 @@
</div> </div>
</td> </td>
</tr> </tr>
{% else %}
<tr><td>{{ "PLUGIN_ADMIN.OFFLINE_WARNING"|tu }}</td></tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@@ -18,7 +18,7 @@
{% if (installing) %}{% set state = 'installing' %}{% endif %} {% if (installing) %}{% set state = 'installing' %}{% endif %}
{% if (config.get('system.pages.theme') == slug) %}{% set state = 'active' %}{% endif %} {% if (config.get('system.pages.theme') == slug) %}{% set state = 'active' %}{% endif %}
{% set isTestingRelease = admin.gpm.isTestingRelease(slug) %} {% 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="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"> <div class="gpm-name">
@@ -56,6 +56,8 @@
</a> </a>
{% endif %} {% endif %}
</div> </div>
{% else %}
<tr><td>{{ "PLUGIN_ADMIN.OFFLINE_WARNING"|tu }}</td></tr>
{% endfor %} {% endfor %}
</div> </div>