From e807e262ff75c4f883d3da5049e7ffad641a4840 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Mon, 12 Feb 2024 00:08:25 -0400 Subject: [PATCH] Use template inheritance when possible in views --- app/controllers/ViewHelper.php | 8 - app/views/admin/base.php | 89 +++++ app/views/admin/dashboard.php | 162 ++++---- app/views/admin/link.php | 135 ++++--- app/views/admin/list.php | 137 ++++--- app/views/admin/login.php | 2 +- app/views/admin/page.php | 225 ++++++----- app/views/admin/partials/nav.php | 71 ---- app/views/admin/password_restore.php | 2 +- app/views/admin/post.php | 277 +++++++------ app/views/admin/settings.php | 483 +++++++++++------------ app/views/admin/tag.php | 159 ++++---- app/views/admin/user.php | 225 ++++++----- app/views/themes/default/blog.php | 2 +- app/views/themes/default/information.php | 2 +- app/views/themes/default/page.php | 2 +- app/views/themes/default/post.php | 2 +- 17 files changed, 991 insertions(+), 992 deletions(-) create mode 100755 app/views/admin/base.php delete mode 100755 app/views/admin/partials/nav.php diff --git a/app/controllers/ViewHelper.php b/app/controllers/ViewHelper.php index d6d626f..4932dc5 100644 --- a/app/controllers/ViewHelper.php +++ b/app/controllers/ViewHelper.php @@ -64,12 +64,4 @@ public function url(string $path = ''): string { return \Aurora\System\Helper::getUrl($path); } - - /** - * @see \Aurora\System\Language::getCode - */ - public function lang(): string - { - return \Aurora\System\Container::get('language')->getCode(); - } } diff --git a/app/views/admin/base.php b/app/views/admin/base.php new file mode 100755 index 0000000..eeefb3d --- /dev/null +++ b/app/views/admin/base.php @@ -0,0 +1,89 @@ + + + + + <?php $this->sectionStart('title') ?> + <?php $this->sectionEnd() ?> + + include('admin/partials/head.php') ?> + + + + + + include('admin/partials/snackbar.php') ?> +
+ sectionStart('content') ?> + sectionEnd() ?> +
+ + + +sectionStart('script') ?> +sectionEnd() ?> diff --git a/app/views/admin/dashboard.php b/app/views/admin/dashboard.php index 4a2a0d1..73112c8 100755 --- a/app/views/admin/dashboard.php +++ b/app/views/admin/dashboard.php @@ -1,97 +1,93 @@ - - - - <?= t('dashboard') . ' - ' . e(setting('title')) ?> - include('admin/partials/head.php') ?> - - - include('admin/partials/nav.php') ?> -
-
-
- include('admin/partials/menu_btn.php') ?> -

-
+extend('admin/base.php') ?> + +sectionStart('title') ?> + +sectionEnd() ?> + +sectionStart('content') ?> +
+
+ include('admin/partials/menu_btn.php') ?> +

-
-
-
- -
-

- -
- +
+
+
+
+
-

- + + -
- +
+
+

+ -
-

-
-
- - - , - , - - -
-
- - - , - - -
-
- - - , - - -
+
+
+

+
+
+ + + , + , + + +
+
+ + + , + + +
+
+ + + , + +
- - +sectionEnd() ?> diff --git a/app/views/admin/link.php b/app/views/admin/link.php index 565b14d..933f890 100755 --- a/app/views/admin/link.php +++ b/app/views/admin/link.php @@ -1,80 +1,79 @@ - - - - <?= t('link') . ' - ' . e(setting('title')) ?> - include('admin/partials/head.php') ?> - - - include('admin/partials/nav.php') ?> -
-
-
- include('admin/partials/menu_btn.php') ?> -

+extend('admin/base.php') ?> + +sectionStart('title') ?> + +sectionEnd() ?> + +sectionStart('content') ?> +
+
+ include('admin/partials/menu_btn.php') ?> +

+
+
+ + + + + +
+
+