From 412f8cee6f9ca5d8c65a8928b2e28d94952a4803 Mon Sep 17 00:00:00 2001 From: Awilum Date: Fri, 24 Jan 2020 16:25:11 +0300 Subject: [PATCH] feat(admin-plugin): update buttons attr in all Controllers #211 --- .../admin/app/Controllers/ApiController.php | 27 ++++++++---------- .../app/Controllers/EntriesController.php | 28 +++++++++---------- .../app/Controllers/FieldsetsController.php | 16 +++++------ .../app/Controllers/PluginsController.php | 10 +++---- .../app/Controllers/SettingsController.php | 2 +- .../app/Controllers/SnippetsController.php | 16 +++++------ .../app/Controllers/TemplatesController.php | 24 ++++++++-------- .../app/Controllers/ThemesController.php | 10 +++---- .../admin/app/Controllers/ToolsController.php | 20 ++++++------- 9 files changed, 74 insertions(+), 79 deletions(-) diff --git a/site/plugins/admin/app/Controllers/ApiController.php b/site/plugins/admin/app/Controllers/ApiController.php index d65cd200..e2e6aa34 100644 --- a/site/plugins/admin/app/Controllers/ApiController.php +++ b/site/plugins/admin/app/Controllers/ApiController.php @@ -35,7 +35,7 @@ class ApiController extends Controller 'api' => [ 'link' => $this->router->pathFor('admin.api.index'), 'title' => __('admin_api'), - 'attributes' => ['class' => 'navigation-top-primary__item navigation-top-primary__item--active'], + 'active' => true, ], ], ] @@ -63,12 +63,11 @@ class ApiController extends Controller 'api' => [ 'link' => $this->router->pathFor('admin.api.index'), 'title' => __('admin_api'), - 'attributes' => ['class' => 'navigation-top-primary__item'], ], 'api_tokens' => [ 'link' => $this->router->pathFor('admin.api_tokens.index') . '?api=' . $api, 'title' => __('admin_' . $api), - 'attributes' => ['class' => 'navigation-top-primary__item navigation-top-primary__item--active'], + 'active' => true ], ], 'buttons' => [ @@ -101,18 +100,16 @@ class ApiController extends Controller 'links' => [ 'api' => [ 'link' => $this->router->pathFor('admin.api.index'), - 'title' => __('admin_api'), - 'attributes' => ['class' => 'navigation-top-primary__item'], + 'title' => __('admin_api') ], 'api_tokens' => [ 'link' => $this->router->pathFor('admin.api_tokens.index') . '?api=' . $api, - 'title' => __('admin_' . $api), - 'attributes' => ['class' => 'navigation-top-primary__item'], + 'title' => __('admin_' . $api) ], 'api_tokens_add' => [ 'link' => $this->router->pathFor('admin.api_tokens.add') . '?api=' . $api, 'title' => __('admin_create_new_' . $api . '_token'), - 'attributes' => ['class' => 'navigation-top-primary__item navigation-top-primary__item--active'], + 'active' => true ], ], ] @@ -196,18 +193,16 @@ class ApiController extends Controller 'links' => [ 'api' => [ 'link' => $this->router->pathFor('admin.api.index'), - 'title' => __('admin_api'), - 'attributes' => ['class' => 'navigation-top-primary__item'], + 'title' => __('admin_api') ], 'api_tokens' => [ 'link' => $this->router->pathFor('admin.api_tokens.index') . '?api=' . $api, - 'title' => __('admin_' . $api), - 'attributes' => ['class' => 'navigation-top-primary__item'], + 'title' => __('admin_' . $api) ], - 'api_tokens_add' => [ - 'link' => $this->router->pathFor('admin.api_tokens.add') . '?api=' . $api, - 'title' => __('admin_create_new_' . $api . '_token'), - 'attributes' => ['class' => 'navigation-top-primary__item navigation-top-primary__item--active'], + 'api_tokens_edit' => [ + 'link' => $this->router->pathFor('admin.api_tokens.edit') . '?api=' . $api, + 'title' => __('admin_edit_' . $api . '_token'), + 'active' => true ], ], ] diff --git a/site/plugins/admin/app/Controllers/EntriesController.php b/site/plugins/admin/app/Controllers/EntriesController.php index c1c149cd..4460fb59 100644 --- a/site/plugins/admin/app/Controllers/EntriesController.php +++ b/site/plugins/admin/app/Controllers/EntriesController.php @@ -165,12 +165,12 @@ class EntriesController extends Controller 'entries' => [ 'link' => $this->router->pathFor('admin.entries.index'), 'title' => __('admin_entries'), - 'attributes' => ['class' => 'btn'] + ], 'entries_add' => [ 'link' => $this->router->pathFor('admin.entries.add') . '?id=' . $this->getEntryID($query), 'title' => __('admin_create_new_entry'), - 'attributes' => ['class' => 'btn active'] + 'active' => true ] ] ] @@ -356,7 +356,7 @@ class EntriesController extends Controller 'entries' => [ 'link' => $this->router->pathFor('admin.entries.index'), 'title' => __('admin_entries'), - 'attributes' => ['class' => 'btn'] + ], 'entries_type' => [ 'link' => $this->router->pathFor('admin.entries.type') . '?id=' . $this->getEntryID($query), @@ -462,7 +462,7 @@ class EntriesController extends Controller 'entries' => [ 'link' => $this->router->pathFor('admin.entries.index'), 'title' => __('admin_entries'), - 'attributes' => ['class' => 'btn'] + ], 'entries_move' => [ 'link' => $this->router->pathFor('admin.entries.move'), @@ -539,7 +539,7 @@ class EntriesController extends Controller 'entries' => [ 'link' => $this->router->pathFor('admin.entries.index'), 'title' => __('admin_entries'), - 'attributes' => ['class' => 'btn'] + ], 'entries_type' => [ 'link' => $this->router->pathFor('admin.entries.rename') . '?id=' . $this->getEntryID($query), @@ -676,17 +676,17 @@ class EntriesController extends Controller 'entries' => [ 'link' => $this->router->pathFor('admin.entries.index') . '?id=' . implode('/', array_slice(explode("/", $this->getEntryID($query)), 0, -1)), 'title' => __('admin_entries'), - 'attributes' => ['class' => 'btn'] + ], 'edit_entry' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query). '&type=editor', 'title' => __('admin_editor'), - 'attributes' => ['class' => 'btn'] + ], 'edit_entry_media' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=media', 'title' => __('admin_media'), - 'attributes' => ['class' => 'btn'] + ], 'edit_entry_source' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=source', @@ -718,12 +718,12 @@ class EntriesController extends Controller 'entries' => [ 'link' => $this->router->pathFor('admin.entries.index') . '?id=' . implode('/', array_slice(explode("/", $this->getEntryID($query)), 0, -1)), 'title' => __('admin_entries'), - 'attributes' => ['class' => 'btn'] + ], 'edit_entry' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=editor', 'title' => __('admin_editor'), - 'attributes' => ['class' => 'btn'] + ], 'edit_entry_media' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=media', @@ -733,7 +733,7 @@ class EntriesController extends Controller 'edit_entry_source' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=source', 'title' => __('admin_source'), - 'attributes' => ['class' => 'btn'] + ], ] ] @@ -760,7 +760,7 @@ class EntriesController extends Controller 'entries' => [ 'link' => $this->router->pathFor('admin.entries.index') . '?id=' . implode('/', array_slice(explode("/", $this->getEntryID($query)), 0, -1)), 'title' => __('admin_entries'), - 'attributes' => ['class' => 'btn'] + ], 'edit_entry' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=editor', @@ -770,12 +770,12 @@ class EntriesController extends Controller 'edit_entry_media' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=media', 'title' => __('admin_media'), - 'attributes' => ['class' => 'btn'] + ], 'edit_entry_source' => [ 'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $this->getEntryID($query) . '&type=source', 'title' => __('admin_source'), - 'attributes' => ['class' => 'btn'] + ], ], 'buttons' => [ diff --git a/site/plugins/admin/app/Controllers/FieldsetsController.php b/site/plugins/admin/app/Controllers/FieldsetsController.php index 77bb3b22..04d25c81 100644 --- a/site/plugins/admin/app/Controllers/FieldsetsController.php +++ b/site/plugins/admin/app/Controllers/FieldsetsController.php @@ -29,14 +29,14 @@ class FieldsetsController extends Controller 'fieldsets' => [ 'link' => $this->router->pathFor('admin.fieldsets.index'), 'title' => __('admin_fieldsets'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ 'fieldsets_add' => [ 'link' => $this->router->pathFor('admin.fieldsets.add'), 'title' => __('admin_create_new_fieldset'), - 'attributes' => ['class' => 'btn'], + ], ], ] @@ -55,12 +55,12 @@ class FieldsetsController extends Controller 'fieldsets' => [ 'link' => $this->router->pathFor('admin.fieldsets.index'), 'title' => __('admin_fieldsets'), - 'attributes' => ['class' => 'btn'], + ], 'fieldsets_add' => [ 'link' => $this->router->pathFor('admin.fieldsets.add'), 'title' => __('admin_create_new_fieldset'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] @@ -121,12 +121,12 @@ class FieldsetsController extends Controller 'fieldsets' => [ 'link' => $this->router->pathFor('admin.fieldsets.index'), 'title' => __('admin_fieldsets'), - 'attributes' => ['class' => 'btn'], + ], 'fieldsets_editor' => [ 'link' => $this->router->pathFor('admin.fieldsets.edit') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_editor'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ @@ -166,12 +166,12 @@ class FieldsetsController extends Controller 'fieldsets' => [ 'link' => $this->router->pathFor('admin.fieldsets.index'), 'title' => __('admin_fieldsets'), - 'attributes' => ['class' => 'btn'], + ], 'fieldsets_rename' => [ 'link' => $this->router->pathFor('admin.fieldsets.rename') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_rename'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] diff --git a/site/plugins/admin/app/Controllers/PluginsController.php b/site/plugins/admin/app/Controllers/PluginsController.php index 64b4ef8c..257d9631 100644 --- a/site/plugins/admin/app/Controllers/PluginsController.php +++ b/site/plugins/admin/app/Controllers/PluginsController.php @@ -39,7 +39,7 @@ class PluginsController extends Controller 'plugins' => [ 'link' => $this->router->pathFor('admin.plugins.index'), 'title' => __('admin_plugins'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ @@ -133,12 +133,12 @@ class PluginsController extends Controller 'plugins' => [ 'link' => $this->router->pathFor('admin.plugins.index'), 'title' => __('admin_plugins'), - 'attributes' => ['class' => 'btn'], + ], 'plugins_information' => [ 'link' => $this->router->pathFor('admin.plugins.information') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_information'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] @@ -193,12 +193,12 @@ class PluginsController extends Controller 'plugins' => [ 'link' => $this->router->pathFor('admin.plugins.index'), 'title' => __('admin_plugins'), - 'attributes' => ['class' => 'btn'], + ], 'plugins_settings' => [ 'link' => $this->router->pathFor('admin.plugins.settings') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_settings'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ diff --git a/site/plugins/admin/app/Controllers/SettingsController.php b/site/plugins/admin/app/Controllers/SettingsController.php index 52a05e4d..dc764b19 100644 --- a/site/plugins/admin/app/Controllers/SettingsController.php +++ b/site/plugins/admin/app/Controllers/SettingsController.php @@ -102,7 +102,7 @@ class SettingsController extends Controller 'settings' => [ 'link' => $this->router->pathFor('admin.settings.index'), 'title' => __('admin_settings'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ diff --git a/site/plugins/admin/app/Controllers/SnippetsController.php b/site/plugins/admin/app/Controllers/SnippetsController.php index 32cae9d2..a2e53205 100644 --- a/site/plugins/admin/app/Controllers/SnippetsController.php +++ b/site/plugins/admin/app/Controllers/SnippetsController.php @@ -36,14 +36,14 @@ class SnippetsController extends Controller 'snippets' => [ 'link' => $this->router->pathFor('admin.snippets.index'), 'title' => __('admin_snippets'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ 'snippets_create' => [ 'link' => $this->router->pathFor('admin.snippets.add'), 'title' => __('admin_create_new_snippet'), - 'attributes' => ['class' => 'btn'], + ], ], ] @@ -67,12 +67,12 @@ class SnippetsController extends Controller 'snippets' => [ 'link' => $this->router->pathFor('admin.snippets.index'), 'title' => __('admin_snippets'), - 'attributes' => ['class' => 'btn'], + ], 'snippets_rename' => [ 'link' => $this->router->pathFor('admin.snippets.add'), 'title' => __('admin_create_new_snippet'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] @@ -126,12 +126,12 @@ class SnippetsController extends Controller 'snippets' => [ 'link' => $this->router->pathFor('admin.snippets.index'), 'title' => __('admin_snippets'), - 'attributes' => ['class' => 'btn'], + ], 'snippets_editor' => [ 'link' => $this->router->pathFor('admin.snippets.edit') . '?id=' . $id, 'title' => __('admin_editor'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ @@ -183,12 +183,12 @@ class SnippetsController extends Controller 'snippets' => [ 'link' => $this->router->pathFor('admin.snippets.index'), 'title' => __('admin_snippets'), - 'attributes' => ['class' => 'btn'], + ], 'snippets_rename' => [ 'link' => $this->router->pathFor('admin.snippets.rename') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_rename'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] diff --git a/site/plugins/admin/app/Controllers/TemplatesController.php b/site/plugins/admin/app/Controllers/TemplatesController.php index b43a51b7..d58a1a2f 100644 --- a/site/plugins/admin/app/Controllers/TemplatesController.php +++ b/site/plugins/admin/app/Controllers/TemplatesController.php @@ -43,19 +43,19 @@ class TemplatesController extends Controller 'themes' => [ 'link' => $this->router->pathFor('admin.themes.index'), 'title' => __('admin_themes'), - 'attributes' => ['class' => 'btn'], + ], 'templates' => [ 'link' => $this->router->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('admin_templates'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ 'templates_create' => [ 'link' => $this->router->pathFor('admin.templates.add') . '?theme=' . $theme, 'title' => __('admin_create_new_template'), - 'attributes' => ['class' => 'btn'], + ], ], ] @@ -83,17 +83,17 @@ class TemplatesController extends Controller 'themes' => [ 'link' => $this->router->pathFor('admin.themes.index'), 'title' => __('admin_themes'), - 'attributes' => ['class' => 'btn'], + ], 'templates' => [ 'link' => $this->router->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('admin_templates'), - 'attributes' => ['class' => 'btn'], + ], 'templates_add' => [ 'link' => $this->router->pathFor('admin.templates.add') . '?theme=' . $theme, 'title' => __('admin_create_new_template'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] @@ -162,17 +162,17 @@ class TemplatesController extends Controller 'themes' => [ 'link' => $this->router->pathFor('admin.themes.index'), 'title' => __('admin_themes'), - 'attributes' => ['class' => 'btn'], + ], 'templates' => [ 'link' => $this->router->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('admin_templates'), - 'attributes' => ['class' => 'btn'], + ], 'templates_editor' => [ 'link' => $this->router->pathFor('admin.templates.edit') . '?id=' . $request->getQueryParams()['id'] . '&type=' . ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template') . '&theme=' . $theme, 'title' => __('admin_editor'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ @@ -232,17 +232,17 @@ class TemplatesController extends Controller 'themes' => [ 'link' => $this->router->pathFor('admin.themes.index'), 'title' => __('admin_themes'), - 'attributes' => ['class' => 'btn'], + ], 'templates' => [ 'link' => $this->router->pathFor('admin.templates.index') . '?theme=' . $theme, 'title' => __('admin_templates'), - 'attributes' => ['class' => 'btn'], + ], 'templates_rename' => [ 'link' => $this->router->pathFor('admin.templates.rename') . '?id=' . $request->getQueryParams()['id'] . '&type=' . ($request->getQueryParams()['type'] && $request->getQueryParams()['type'] === 'partial' ? 'partial' : 'template') . '&theme=' . $theme, 'title' => __('admin_rename'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] diff --git a/site/plugins/admin/app/Controllers/ThemesController.php b/site/plugins/admin/app/Controllers/ThemesController.php index b21a27a8..e8cce2b1 100644 --- a/site/plugins/admin/app/Controllers/ThemesController.php +++ b/site/plugins/admin/app/Controllers/ThemesController.php @@ -41,7 +41,7 @@ class ThemesController extends Controller 'themes' => [ 'link' => $this->router->pathFor('admin.themes.index'), 'title' => __('admin_themes'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ @@ -179,12 +179,12 @@ class ThemesController extends Controller 'themes' => [ 'link' => $this->router->pathFor('admin.themes.index'), 'title' => __('admin_themes'), - 'attributes' => ['class' => 'btn'], + ], 'themes_information' => [ 'link' => $this->router->pathFor('admin.themes.information') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_information'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ] @@ -238,12 +238,12 @@ class ThemesController extends Controller 'themes' => [ 'link' => $this->router->pathFor('admin.themes.index'), 'title' => __('admin_themes'), - 'attributes' => ['class' => 'btn'], + ], 'themes_settings' => [ 'link' => $this->router->pathFor('admin.themes.settings') . '?id=' . $request->getQueryParams()['id'], 'title' => __('admin_settings'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], 'buttons' => [ diff --git a/site/plugins/admin/app/Controllers/ToolsController.php b/site/plugins/admin/app/Controllers/ToolsController.php index b2368760..13c762df 100644 --- a/site/plugins/admin/app/Controllers/ToolsController.php +++ b/site/plugins/admin/app/Controllers/ToolsController.php @@ -57,17 +57,17 @@ class ToolsController extends Controller 'information' => [ 'link' => $this->router->pathFor('admin.tools.index'), 'title' => __('admin_information'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], 'cache' => [ 'link' => $this->router->pathFor('admin.tools.cache'), 'title' => __('admin_cache'), - 'attributes' => ['class' => 'btn'], + ], 'registry' => [ 'link' => $this->router->pathFor('admin.tools.registry'), 'title' => __('admin_registry'), - 'attributes' => ['class' => 'btn'], + ], ], ] @@ -94,17 +94,17 @@ class ToolsController extends Controller 'information' => [ 'link' => $this->router->pathFor('admin.tools.index'), 'title' => __('admin_information'), - 'attributes' => ['class' => 'btn'], + ], 'cache' => [ 'link' => $this->router->pathFor('admin.tools.cache'), 'title' => __('admin_cache'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], 'registry' => [ 'link' => $this->router->pathFor('admin.tools.registry'), 'title' => __('admin_registry'), - 'attributes' => ['class' => 'btn'], + ], ], 'buttons' => [ @@ -113,7 +113,7 @@ class ToolsController extends Controller 'id' => 'clear-cache-all', 'link' => $this->router->pathFor('admin.tools.clearCacheAllProcess'), 'title' => __('admin_clear_cache_all'), - 'attributes' => ['class' => 'btn'], + ], ], ] @@ -138,17 +138,17 @@ class ToolsController extends Controller 'information' => [ 'link' => $this->router->pathFor('admin.tools.index'), 'title' => __('admin_information'), - 'attributes' => ['class' => 'btn'], + ], 'cache' => [ 'link' => $this->router->pathFor('admin.tools.cache'), 'title' => __('admin_cache'), - 'attributes' => ['class' => 'btn'], + ], 'registry' => [ 'link' => $this->router->pathFor('admin.tools.registry'), 'title' => __('admin_registry'), - 'attributes' => ['class' => 'btn active'], + 'active' => true ], ], ]