diff --git a/.editorconfig b/.editorconfig index 505fbb1a..6375a81e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# EditorConfig is awesome: http://EditorConfig.org +# EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true @@ -12,6 +12,6 @@ insert_final_newline = true indent_style = space indent_size = 2 -# 2 space indentation -[*.{yaml,.yml}] -indent_size = 2 +# 4 space indentation +[*.php] +indent_size = 4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d81e793..386892e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,40 @@ +# v1.10.30 +## 02/07/2022 + +1. [](#new) + * Require **Grav 1.7.30** + * Updated SCSS compiler to v1.10 + * PageMedia can now be collapsed and thumbnails previewed smaller, in order to save room on the page. Selection will be remembered. + * DEPRECATED: Admin field `pages_list_display_field` is no longer available as an option [#2191](https://github.com/getgrav/grav-plugin-admin/issues/2191) + * When listing installable themes/plugins, it is now possible to sort them by [Premium](https://getgrav.org/premium) +2. [](#improved) + * Updated JavaScript dependencies + * Cleaned up JavaScript unused dependencies and warnings + * Removed unused style assets + * Plugins list rows now properly highlight on hover, no more guessing when wanting to disable a plugin! +3. [](#bugfix) + * Fixed `elements` field when it's used inside `list` field + * Fixed issue uploading non-images media when Resolution setting enabled in Admin [#2172](https://github.com/getgrav/grav-plugin-admin/issues/2172) + * Prevent fields from being toggled incorrectly by adding originalValue to childs of fieldset. [#2218](https://github.com/getgrav/grav-plugin-admin/pull/2218) + * Fixed persistent focus on Folder field when Adding page (Safari) [#2209](https://github.com/getgrav/grav-plugin-admin/issues/2209) + * Fixed performance of Plugins / Themes sort in the installation table + * Fixed list field with key/value pairs throwing an exception due to bad value [#2199](https://github.com/getgrav/grav-plugin-admin/issues/2199) + * Fixed disabling/enabling plugin from the list breaking the plugin configuration + # v1.10.29 ## 01/28/2022 1. [](#new) * Require **Grav 1.7.29** 3. [](#improved) - * Made path handling unicode-safe, use new `Utils::basename()` and `Utils::pathinfo()` everywhere + * Made path handling unicode-safe, use new `Utils::basename()` and `Utils::pathinfo()` everywhere # v1.10.28 ## 01/24/2022 1. [](#bugfix) - * Clean file names before displaying errors/metadata modals - * Recompiled JS for production [#2225](https://github.com/getgrav/grav-plugin-admin/issues/2225) + * Clean file names before displaying errors/metadata modals + * Recompiled JS for production [#2225](https://github.com/getgrav/grav-plugin-admin/issues/2225) # v1.10.27 ## 01/12/2022 diff --git a/README.md b/README.md index d894296b..4a7d6541 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Grav Standard Administration Panel Plugin -This **admin plugin** for [Grav](http://github.com/getgrav/grav) is an HTML user interface that provides a convenient way to configure Grav and easily create and modify pages. This will remain a totally optional plugin, and is not in any way required or needed to use Grav effectively. In fact, the admin provides an intentionally limited view to ensure it remains easy to use and not overwhelming. I'm sure power users will still prefer to work with the configuration files directly. +This **admin plugin** for [Grav](https://github.com/getgrav/grav) is an HTML user interface that provides a convenient way to configure Grav and easily create and modify pages. This will remain a totally optional plugin, and is not in any way required or needed to use Grav effectively. In fact, the admin provides an intentionally limited view to ensure it remains easy to use and not overwhelming. I'm sure power users will still prefer to work with the configuration files directly.  @@ -33,7 +33,7 @@ This **admin plugin** for [Grav](http://github.com/getgrav/grav) is an HTML user We have tested internally, but we hope to use this public beta phase to identify, isolate, and fix issues related to the plugin to ensure it is as solid and reliable as possible. -For **live chatting**, please use the dedicated [Slack Chat Room](https://getgrav.org/slack) for discussions directly related to Grav. +For **live chatting**, please use the dedicated [Discord Chat Room](https://getgrav.org/discord) for discussions directly related to Grav. For **bugs, features, improvements**, please ensure you [create issues in the admin plugin GitHub repository](https://github.com/getgrav/grav-plugin-admin). @@ -99,7 +99,7 @@ By default, you can access the admin by pointing your browser to `http://yoursit # Standard Free & Paid Pro Versions -If you have been following the [blog](http://getgrav.org/blog), [Twitter](https://twitter.com/getgrav), [Slack chat](https://getgrav.org/slack), etc., you probably already know now that our intention is to provide two versions of this plugin. +If you have been following the [blog](https://getgrav.org/blog), [Twitter](https://twitter.com/getgrav), [Discord chat](https://getgrav.org/discord), etc., you probably already know now that our intention is to provide two versions of this plugin. The **standard free version**, is very powerful, and has more functionality than most commercial flat-file CMS systems. diff --git a/admin.php b/admin.php index 68a8b93b..e15e19e3 100644 --- a/admin.php +++ b/admin.php @@ -119,6 +119,12 @@ class AdminPlugin extends Plugin 'list' => [ 'array' => true ], + 'elements' => [ + 'input@' => false + ], + 'element' => [ + 'input@' => false + ], 'file' => [ 'array' => true, 'media_field' => true, diff --git a/admin.yaml b/admin.yaml index e785124d..c23f95b1 100644 --- a/admin.yaml +++ b/admin.yaml @@ -26,7 +26,6 @@ session: edit_mode: normal frontend_preview_target: inline show_github_msg: true -pages_list_display_field: title admin_icons: line-awesome enable_auto_updates_check: true notifications: diff --git a/blueprints.yaml b/blueprints.yaml index c47983af..1fd8a4cb 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,13 +1,13 @@ name: Admin Panel slug: admin type: plugin -version: 1.10.29 +version: 1.10.30 description: Adds an advanced administration panel to manage your site icon: empire author: name: Team Grav email: devs@getgrav.org - url: http://getgrav.org + url: https://getgrav.org homepage: https://github.com/getgrav/grav-plugin-admin keywords: admin, plugin, manager, panel bugs: https://github.com/getgrav/grav-plugin-admin/issues @@ -15,7 +15,7 @@ docs: https://github.com/getgrav/grav-plugin-admin/blob/develop/README.md license: MIT dependencies: - - { name: grav, version: '>=1.7.29' } + - { name: grav, version: '>=1.7.30' } - { name: form, version: '>=5.1.0' } - { name: login, version: '>=3.6.2' } - { name: email, version: '>=3.1.0' } @@ -202,12 +202,6 @@ form: type: bool help: PLUGIN_ADMIN.SHOW_GITHUB_LINK_HELP - pages_list_display_field: - type: text - size: small - label: PLUGIN_ADMIN.PAGES_LIST_DISPLAY_FIELD - help: PLUGIN_ADMIN.PAGES_LIST_DISPLAY_FIELD_HELP - enable_auto_updates_check: type: toggle label: PLUGIN_ADMIN.AUTO_UPDATES diff --git a/classes/plugin/AdminController.php b/classes/plugin/AdminController.php index 61dbceb0..1a837532 100644 --- a/classes/plugin/AdminController.php +++ b/classes/plugin/AdminController.php @@ -22,6 +22,7 @@ use Grav\Common\Page\Medium\Medium; use Grav\Common\Page\Page; use Grav\Common\Page\Pages; use Grav\Common\Page\Collection; +use Grav\Common\Plugins; use Grav\Common\Security; use Grav\Common\User\Interfaces\UserCollectionInterface; use Grav\Common\User\Interfaces\UserInterface; @@ -35,6 +36,7 @@ use PicoFeed\Parser\MalformedXmlException; use Psr\Http\Message\ResponseInterface; use RocketTheme\Toolbox\Event\Event; use RocketTheme\Toolbox\File\File; +use RocketTheme\Toolbox\File\YamlFile; use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator; use Twig\Loader\FilesystemLoader; @@ -629,10 +631,8 @@ class AdminController extends AdminBaseController return false; } - // Filter value and save it. - $this->post = ['enabled' => true]; - $obj = $this->prepareData($this->post); - $obj->save(); + $type = $this->getDataType(); + $this->updatePluginState($type, ['enabled' => true]); $this->post = ['_redirect' => 'plugins']; if ($this->grav['uri']->param('redirect')) { @@ -662,10 +662,8 @@ class AdminController extends AdminBaseController return false; } - // Filter value and save it. - $this->post = ['enabled' => false]; - $obj = $this->prepareData($this->post); - $obj->save(); + $type = $this->getDataType(); + $this->updatePluginState($type, ['enabled' => false]); $this->post = ['_redirect' => 'plugins']; $this->admin->setMessage($this->admin::translate('PLUGIN_ADMIN.SUCCESSFULLY_DISABLED_PLUGIN'), 'info'); @@ -675,6 +673,30 @@ class AdminController extends AdminBaseController return true; } + /** + * @param string $type + * @param array $value + * @return void + */ + protected function updatePluginState(string $type, array $value): void + { + $obj = Plugins::get(preg_replace('|plugins/|', '', $type)); + if (null === $obj) { + throw new \RuntimeException("Plugin '{$type}' doesn't exist!"); + } + + /** @var UniformResourceLocator $locator */ + $locator = $this->grav['locator']; + + // Configuration file will be saved to the existing config stream. + $filename = $locator->findResource('config://') . "/{$type}.yaml"; + + $file = YamlFile::instance($filename); + $contents = $value + $file->content(); + + $file->save($contents); + } + /** * Set the default theme. * diff --git a/classes/plugin/Gpm.php b/classes/plugin/Gpm.php index 8fda8c1f..61975d05 100644 --- a/classes/plugin/Gpm.php +++ b/classes/plugin/Gpm.php @@ -363,7 +363,7 @@ class Gpm $error[] = '
Grav has increased the minimum PHP requirement.
';
$error[] = 'You are currently running PHP ' . phpversion() . '';
$error[] = ', but PHP ' . $upgrader->minPHPVersion() . ' is required.