diff --git a/CHANGELOG.md b/CHANGELOG.md index 259151b8..22a2c791 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# v1.2.8 +## 01/17/2017 + +1. [](#improved) + * Allow the ability to clear the cache if `admin.maintenance`, as stated in the docs [#908](https://github.com/getgrav/grav-plugin-admin/issues/908) + * Added lang strings for `DEFAULT_LANG` in Site configuration + * Added lang strings for `NEVER_CACHE_TWIG` in System and Page configuration +1. [](#bugfix) + * Fixed saving the configuration if not `admin.super` + * Show the clear cache buttons if the user has `admin.cache` permissions [#908](https://github.com/getgrav/grav-plugin-admin/issues/908#issuecomment-270748616) + * Fix colorpicker validation when transparency is set to 1.00 [#921](https://github.com/getgrav/grav-plugin-admin/issues/921) + * Fix html markup in section twig [#922](https://github.com/getgrav/grav-plugin-admin/pull/922) + * Fix bug in deleting a file uploaded with the `file` field [#920](github.com/getgrav/grav-plugin-admin/issues/920) + * Fix for plugin throwing event-based errors when plugin is removed and no longer available to process said event + # v1.2.7 ## 12/22/2016 diff --git a/blueprints.yaml b/blueprints.yaml index 2e16b39b..b4f17127 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Admin Panel -version: 1.2.7 +version: 1.2.8 description: Adds an advanced administration panel to manage your site icon: empire author: diff --git a/classes/adminbasecontroller.php b/classes/adminbasecontroller.php index deea2244..5e651286 100644 --- a/classes/adminbasecontroller.php +++ b/classes/adminbasecontroller.php @@ -420,6 +420,7 @@ class AdminBaseController switch ($type) { case 'configuration': + case 'config': case 'system': $permissions[] = 'admin.configuration'; break; @@ -804,11 +805,6 @@ class AdminBaseController $type = $uri->param('type'); $field = $uri->param('field'); - $event = $this->grav->fireEvent('onAdminCanSave', new Event(['controller' => &$this])); - if (!$event['can_save']) { - return false; - } - $this->taskRemoveMedia(); if ($type == 'pages') { diff --git a/classes/admincontroller.php b/classes/admincontroller.php index 5391e944..40af7f94 100644 --- a/classes/admincontroller.php +++ b/classes/admincontroller.php @@ -958,12 +958,11 @@ class AdminController extends AdminBaseController $type = isset($data['type']) ? $data['type'] : ''; if (!$this->authorizeTask('uninstall ' . $type, ['admin.' . $type, 'admin.super'])) { - $this->admin->json_response = [ + $json_response = [ 'status' => 'error', 'message' => $this->admin->translate('PLUGIN_ADMIN.INSUFFICIENT_PERMISSIONS_FOR_TASK') ]; - - return false; + echo json_encode($json_response);exit; } //check if there are packages that have this as a dependency. Abort and show which ones @@ -977,31 +976,31 @@ class AdminController extends AdminBaseController $dependent_packages) . " depends on this package. Please remove it first."; } - $this->admin->json_response = ['status' => 'error', 'message' => $message]; - - return false; + $json_response = ['status' => 'error', 'message' => $message]; + echo json_encode($json_response);exit; } try { $dependencies = $this->admin->dependenciesThatCanBeRemovedWhenRemoving($package); $result = Gpm::uninstall($package, []); } catch (\Exception $e) { - $this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()]; - - return false; + $json_response = ['status' => 'error', 'message' => $e->getMessage()]; + echo json_encode($json_response);exit; } if ($result) { - $this->admin->json_response = [ + $json_response = [ 'status' => 'success', 'dependencies' => $dependencies, 'message' => $this->admin->translate(is_string($result) ? $result : 'PLUGIN_ADMIN.UNINSTALL_SUCCESSFUL') ]; + echo json_encode($json_response);exit; } else { - $this->admin->json_response = [ + $json_response = [ 'status' => 'error', 'message' => $this->admin->translate('PLUGIN_ADMIN.UNINSTALL_FAILED') ]; + echo json_encode($json_response);exit; } return true; @@ -1102,7 +1101,7 @@ class AdminController extends AdminBaseController */ protected function taskClearCache() { - if (!$this->authorizeTask('clear cache', ['admin.cache', 'admin.super'])) { + if (!$this->authorizeTask('clear cache', ['admin.cache', 'admin.super', 'admin.maintenance'])) { return false; } diff --git a/languages/en.yaml b/languages/en.yaml index d112bb40..7221a21a 100644 --- a/languages/en.yaml +++ b/languages/en.yaml @@ -187,6 +187,9 @@ PLUGIN_ADMIN: SITE_TITLE: "Site Title" SITE_TITLE_PLACEHOLDER: "Site wide title" SITE_TITLE_HELP: "Default title for your site, often used in themes" + SITE_DEFAULT_LANG: "Default language" + SITE_DEFAULT_LANG_PLACEHOLDER: "Default language to be used by theme's tag" + SITE_DEFAULT_LANG_HELP: "Default language to be used by theme's tag" DEFAULT_AUTHOR: "Default Author" DEFAULT_AUTHOR_HELP: "A default author name, often used in themes or page content" DEFAULT_EMAIL: "Default Email" @@ -625,4 +628,6 @@ PLUGIN_ADMIN: REDIS_SOCKET: "Redis socket" REDIS_SOCKET_HELP: "The Redis socket" NOT_SET: "Not set" - PERMISSIONS: "Permissions" \ No newline at end of file + PERMISSIONS: "Permissions" + NEVER_CACHE_TWIG: "Never Cache Twig" + NEVER_CACHE_TWIG_HELP: "Only cache content and process Twig every time for pages. Ignores twig_first setting." diff --git a/themes/grav/templates/dashboard.html.twig b/themes/grav/templates/dashboard.html.twig index 12406cc9..e6f85927 100644 --- a/themes/grav/templates/dashboard.html.twig +++ b/themes/grav/templates/dashboard.html.twig @@ -6,7 +6,7 @@ {% block titlebar %}
- {% if authorize(['admin.maintenance', 'admin.super']) %} + {% if authorize(['admin.maintenance', 'admin.super', 'admin.cache']) %}
- + {% endif %} + {% if authorize(['admin.maintenance', 'admin.super']) %} {% endif %}
diff --git a/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig b/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig index a1355a31..5b53c63d 100644 --- a/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig +++ b/themes/grav/templates/forms/fields/colorpicker/colorpicker.html.twig @@ -1,7 +1,7 @@ {% extends "forms/field.html.twig" %} {% set originalValue = originalValue is defined ? originalValue : value %} {% set value = (value is null ? field.default : value) %} -{% set pattern = '^#([a-fA-F0-9]{6})|(rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*((0.[0-9]+)|[01])\\s*\\))$' %} +{% set pattern = '^#([a-fA-F0-9]{6})|(rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*((0.[0-9]+)|(1.00)|1.0|1)\\s*\\))$' %} {% block input %}
diff --git a/themes/grav/templates/forms/fields/section/section.html.twig b/themes/grav/templates/forms/fields/section/section.html.twig index 4f967b7b..e168bd00 100644 --- a/themes/grav/templates/forms/fields/section/section.html.twig +++ b/themes/grav/templates/forms/fields/section/section.html.twig @@ -5,7 +5,7 @@ {% endif %} {% if field.text %} -

{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu|raw }}{% else %}{{ field.text|t|raw }}{% endif %}

+

{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu|raw }}{% else %}{{ field.text|t|raw }}{% endif %}

{% endif %} {% if field.fields %} diff --git a/themes/grav/templates/plugins.json.twig b/themes/grav/templates/plugins.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/plugins.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %} diff --git a/themes/grav/templates/themes.json.twig b/themes/grav/templates/themes.json.twig deleted file mode 100644 index b98dabca..00000000 --- a/themes/grav/templates/themes.json.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% if admin.json_response %} -{{ admin.json_response|json_encode|raw }} -{% else %} -{} -{% endif %}