From 202d265cab0c6f099d0b7cbd1dbd247ebe3e6880 Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Tue, 19 Nov 2024 11:21:46 +0300 Subject: [PATCH] action button widget --- kernel/admin_themes/default/layout/main.php | 2 +- kernel/controllers/ModuleController.php | 2 -- kernel/views/module/index.php | 4 ++-- kernel/widgets/ActionButtonWidget.php | 16 ++++++++++++++++ views/widgets/admin/action_button.php | 9 +++++++++ 5 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 kernel/widgets/ActionButtonWidget.php create mode 100644 views/widgets/admin/action_button.php diff --git a/kernel/admin_themes/default/layout/main.php b/kernel/admin_themes/default/layout/main.php index 704683f..5864fb1 100644 --- a/kernel/admin_themes/default/layout/main.php +++ b/kernel/admin_themes/default/layout/main.php @@ -14,7 +14,7 @@ - + diff --git a/kernel/controllers/ModuleController.php b/kernel/controllers/ModuleController.php index fab7bd3..18262cb 100644 --- a/kernel/controllers/ModuleController.php +++ b/kernel/controllers/ModuleController.php @@ -122,8 +122,6 @@ class ModuleController extends AdminController $this->redirect("/admin/module_shop_client/update/?slug=" . $slug, 302); } - - $this->cgView->render("view.php", ['data' => $mod_info]); } diff --git a/kernel/views/module/index.php b/kernel/views/module/index.php index 3cbf641..f615734 100644 --- a/kernel/views/module/index.php +++ b/kernel/views/module/index.php @@ -34,9 +34,9 @@ $table->addAction(function ($row, $url) use ($moduleService) { $btn = "$label"; } else { - $label = "Активировать"; + $label = ""; $btn_type = "success"; - $btn = "$label"; + $btn = "$label"; } return $btn; diff --git a/kernel/widgets/ActionButtonWidget.php b/kernel/widgets/ActionButtonWidget.php new file mode 100644 index 0000000..adea90f --- /dev/null +++ b/kernel/widgets/ActionButtonWidget.php @@ -0,0 +1,16 @@ +data['icon']; + $btn = $this->data['btn']; + $url = $this->data['url']; + $this->cgView->render('/admin/action_button.php', ['icon' => $icon, 'btn' => $btn, 'url' => $url]); + } +} \ No newline at end of file diff --git a/views/widgets/admin/action_button.php b/views/widgets/admin/action_button.php new file mode 100644 index 0000000..f04355c --- /dev/null +++ b/views/widgets/admin/action_button.php @@ -0,0 +1,9 @@ + + +"$label"; \ No newline at end of file