mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-03 11:55:52 +01:00
Major speedup on Dashboard (latest pages using Flex)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
## mm/dd/2019
|
## mm/dd/2019
|
||||||
|
|
||||||
1. [](#improved)
|
1. [](#improved)
|
||||||
* Optimize admin for speed (only load frontend pages on demand)
|
* Optimized admin for speed (only load frontend pages on demand)
|
||||||
|
|
||||||
# v1.10.0-beta.5
|
# v1.10.0-beta.5
|
||||||
## 08/11/2019
|
## 08/11/2019
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace Grav\Plugin\Admin;
|
|||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Grav\Common\Cache;
|
use Grav\Common\Cache;
|
||||||
|
use Grav\Common\Config\Config;
|
||||||
use Grav\Common\Data;
|
use Grav\Common\Data;
|
||||||
use Grav\Common\File\CompiledYamlFile;
|
use Grav\Common\File\CompiledYamlFile;
|
||||||
use Grav\Common\GPM\GPM;
|
use Grav\Common\GPM\GPM;
|
||||||
@@ -26,6 +27,7 @@ use Grav\Common\User\Interfaces\UserCollectionInterface;
|
|||||||
use Grav\Common\User\User;
|
use Grav\Common\User\User;
|
||||||
use Grav\Common\Utils;
|
use Grav\Common\Utils;
|
||||||
use Grav\Framework\Collection\ArrayCollection;
|
use Grav\Framework\Collection\ArrayCollection;
|
||||||
|
use Grav\Framework\Flex\Flex;
|
||||||
use Grav\Framework\Route\Route;
|
use Grav\Framework\Route\Route;
|
||||||
use Grav\Framework\Route\RouteFactory;
|
use Grav\Framework\Route\RouteFactory;
|
||||||
use Grav\Plugin\Login\Login;
|
use Grav\Plugin\Login\Login;
|
||||||
@@ -1157,6 +1159,15 @@ class Admin
|
|||||||
*/
|
*/
|
||||||
public function latestPages($count = 10)
|
public function latestPages($count = 10)
|
||||||
{
|
{
|
||||||
|
/** @var Config $config */
|
||||||
|
$config = $this->grav['config'];
|
||||||
|
if ($config->get('system.pages.type') === 'flex') {
|
||||||
|
/** @var Flex $flex */
|
||||||
|
$flex = $this->grav['flex_objects'];
|
||||||
|
$directory = $flex ? $flex->getDirectory('grav-pages') : null;
|
||||||
|
return $directory ? $directory->getIndex()->sort(['timestamp' => 'DESC'])->slice(0, $count) : [];
|
||||||
|
}
|
||||||
|
|
||||||
$pages = static::enablePages();
|
$pages = static::enablePages();
|
||||||
|
|
||||||
$latest = [];
|
$latest = [];
|
||||||
|
|||||||
@@ -6,10 +6,11 @@
|
|||||||
<h1>{{ "PLUGIN_ADMIN.LATEST_PAGE_UPDATES"|tu }}</h1>
|
<h1>{{ "PLUGIN_ADMIN.LATEST_PAGE_UPDATES"|tu }}</h1>
|
||||||
<table>
|
<table>
|
||||||
{% for latest in admin.latestPages if admin.latestPages %}
|
{% for latest in admin.latestPages if admin.latestPages %}
|
||||||
|
{% set route = latest.rawRoute %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="triple page-title">
|
<td class="triple page-title">
|
||||||
<a href="{{ base_url }}/pages/{{ latest.route|trim('/') }}"><i class="fa fa-fw fa-file-text-o"></i> {{ latest.title|e }}</a></td>
|
<a href="{{ base_url }}/pages/{{ route|trim('/') }}"><i class="fa fa-fw fa-file-text-o"></i> {{ latest.title|e }}</a></td>
|
||||||
<td class="triple page-route">{{ latest.route }}</td><td>{{ latest.modified|adminNicetime }}</td>
|
<td class="triple page-route">{{ route }}</td><td>{{ latest.modified|adminNicetime }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user