diff --git a/app/admin_themes/custom/layout/main.php b/app/admin_themes/custom/layout/main.php index 619976d..c631ff9 100644 --- a/app/admin_themes/custom/layout/main.php +++ b/app/admin_themes/custom/layout/main.php @@ -13,7 +13,7 @@ - + diff --git a/app/modules/tag/controllers/TagController.php b/app/modules/tag/controllers/TagController.php index e0212a2..4598872 100644 --- a/app/modules/tag/controllers/TagController.php +++ b/app/modules/tag/controllers/TagController.php @@ -5,9 +5,4 @@ namespace app\modules\tag\controllers; class TagController extends \kernel\app_modules\tag\controllers\TagController { - public function actionByEntity() - { - // TODO - } - } \ No newline at end of file diff --git a/app/modules/tag/manifest.json b/app/modules/tag/manifest.json index 39df526..3967dd6 100644 --- a/app/modules/tag/manifest.json +++ b/app/modules/tag/manifest.json @@ -1,6 +1,6 @@ { "name": "Tags", - "version": "0.12", + "version": "0.2", "author": "ITGuild", "slug": "tag", "description": "Tags module", diff --git a/kernel/admin_themes/simple/layout/main.php b/kernel/admin_themes/simple/layout/main.php index c1f7972..217dd6c 100644 --- a/kernel/admin_themes/simple/layout/main.php +++ b/kernel/admin_themes/simple/layout/main.php @@ -13,7 +13,7 @@ - + diff --git a/kernel/app_modules/tag/views/index.php b/kernel/app_modules/tag/views/index.php index ceacd8f..0d5503f 100644 --- a/kernel/app_modules/tag/views/index.php +++ b/kernel/app_modules/tag/views/index.php @@ -8,6 +8,10 @@ use Itguild\EloquentTable\EloquentDataProvider; use Itguild\EloquentTable\ListEloquentTable; use kernel\app_modules\tag\models\Tag; use kernel\IGTabel\btn\PrimaryBtn; +use kernel\models\Menu; +use kernel\modules\menu\table\columns\MenuDeleteActionColumn; +use kernel\modules\menu\table\columns\MenuEditActionColumn; +use kernel\modules\menu\table\columns\MenuViewActionColumn; $table = new ListEloquentTable(new EloquentDataProvider(Tag::class, [ 'currentPage' => $page_number, diff --git a/kernel/modules/admin_themes/views/index.php b/kernel/modules/admin_themes/views/index.php index 14ca134..9a2ab7e 100644 --- a/kernel/modules/admin_themes/views/index.php +++ b/kernel/modules/admin_themes/views/index.php @@ -3,9 +3,6 @@ * @var $json string */ -use kernel\models\Option; -use kernel\widgets\ActionButtonWidget; - $table = new \Itguild\Tables\ListJsonTable($json); $table->columns([ @@ -14,19 +11,15 @@ $table->columns([ } ]); $table->addAction(function ($row, $url){ - $path = $row['path']; $active_admin_theme = \kernel\modules\option\service\OptionService::getItem('active_admin_theme'); - $btn = ActionButtonWidget::create([ - 'btn_type' => "primary", - 'label' => "Активировать", - 'url' => "$url/activate/?p=$path", - ])->run(); - if ($path === $active_admin_theme){ - $btn = "Активна"; + if ($row['path'] === $active_admin_theme){ + return "Активна"; + } else { + $url = "$url/activate/?p=" . $row['path']; + + return \kernel\widgets\IconBtn\IconBtnActivateWidget::create(['url' => $url])->run(); } - - return $btn; }); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/modules/admin_themes/views/view.php b/kernel/modules/admin_themes/views/view.php index 2f535b2..e6e0c3e 100644 --- a/kernel/modules/admin_themes/views/view.php +++ b/kernel/modules/admin_themes/views/view.php @@ -23,8 +23,7 @@ $table->rows([ } ]); $table->beforePrint(function () { - $btn = PrimaryBtn::create("Список", "/admin/settings/admin-themes")->fetch(); - return $btn; + return \kernel\widgets\IconBtn\IconBtnListWidget::create(['url' => '/admin/settings/admin-themes'])->run(); }); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/modules/menu/views/index.php b/kernel/modules/menu/views/index.php index 4f445df..35db706 100644 --- a/kernel/modules/menu/views/index.php +++ b/kernel/modules/menu/views/index.php @@ -6,11 +6,11 @@ use Itguild\EloquentTable\EloquentDataProvider; use Itguild\EloquentTable\ListEloquentTable; -use kernel\IGTabel\action_column\DeleteActionColumn; -use kernel\IGTabel\action_column\EditActionColumn; -use kernel\IGTabel\action_column\ViewActionColumn; -use kernel\IGTabel\btn\PrimaryBtn; use kernel\models\Menu; +use kernel\widgets\IconBtn\IconBtnCreateWidget; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnViewWidget; $table = new ListEloquentTable(new EloquentDataProvider(Menu::class, [ 'currentPage' => $page_number, @@ -25,11 +25,17 @@ $table->columns([ }), ]); $table->beforePrint(function () { - return PrimaryBtn::create("Создать", "/admin/settings/menu/create")->fetch(); - //return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch(); + return IconBtnCreateWidget::create(['url' => '/admin/settings/menu/create'])->run(); +}); + +$table->addAction(function($row) { + return IconBtnViewWidget::create(['url' => '/admin/settings/menu/view/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnEditWidget::create(['url' => '/admin/settings/menu/update/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnDeleteWidget::create(['url' => '/admin/settings/menu/delete/' . $row['id']])->run(); }); -$table->addAction(ViewActionColumn::class); -$table->addAction(EditActionColumn::class); -$table->addAction(DeleteActionColumn::class); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/modules/menu/views/view.php b/kernel/modules/menu/views/view.php index 5e73c57..00c404c 100644 --- a/kernel/modules/menu/views/view.php +++ b/kernel/modules/menu/views/view.php @@ -6,10 +6,10 @@ use Itguild\EloquentTable\ViewEloquentTable; use Itguild\EloquentTable\ViewJsonTableEloquentModel; -use kernel\IGTabel\btn\DangerBtn; -use kernel\IGTabel\btn\PrimaryBtn; -use kernel\IGTabel\btn\SuccessBtn; use kernel\models\Menu; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnListWidget; $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($menu, [ 'params' => ["class" => "table table-bordered", "border" => "2"], @@ -17,9 +17,9 @@ $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($menu, [ ])); $table->beforePrint(function () use ($menu) { - $btn = PrimaryBtn::create("Список", "/admin/settings/menu")->fetch(); - $btn .= SuccessBtn::create("Редактировать", "/admin/settings/menu/update/" . $menu->id)->fetch(); - $btn .= DangerBtn::create("Удалить", "/admin/settings/menu/delete/" . $menu->id)->fetch(); + $btn = IconBtnListWidget::create(['url' => '/admin/settings/menu'])->run(); + $btn .= IconBtnEditWidget::create(['url' => '/admin/settings/menu/update/' . $menu->id])->run(); + $btn .= IconBtnDeleteWidget::create(['url' => '/admin/settings/menu/delete/' . $menu->id])->run(); return $btn; }); $table->rows([ diff --git a/kernel/modules/module_shop_client/views/index.php b/kernel/modules/module_shop_client/views/index.php index c54f279..bfe766d 100644 --- a/kernel/modules/module_shop_client/views/index.php +++ b/kernel/modules/module_shop_client/views/index.php @@ -31,31 +31,21 @@ $info_to_table['data'] = $modules_info; $table = new ListJsonTable(json_encode($info_to_table, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); $table->addAction(function ($row, $url) use ($moduleService) { - $id = $row['id']; + $url = "$url/view/" . $row['id']; - return ActionButtonWidget::create([ - 'btn_type' => "primary", - 'label' => "", - 'url' => "$url/view/$id", - ])->run(); + return \kernel\widgets\IconBtn\IconBtnViewWidget::create(['url' => $url])->run(); }); $table->addAction(function ($row, $url) use ($moduleService){ - $slug = $row['slug']; - $id = $row['id']; - if ($moduleService->isInstall($slug)){ - return ActionButtonWidget::create([ - 'btn_type' => "danger", - 'label' => "", - 'url' => "$url/delete/?slug=$slug", - ])->run(); + if ($moduleService->isInstall($row['slug'])){ + $url = "$url/delete/?slug=" . $row['slug']; + + return \kernel\widgets\IconBtn\IconBtnDeleteWidget::create(['url' => $url])->run(); } else { - return ActionButtonWidget::create([ - 'btn_type' => "success", - 'label' => "", - 'url' => "$url/install/?id=$id", - ])->run(); + $url = "$url/install/?id=" . $row['id']; + + return \kernel\widgets\IconBtn\IconBtnInstallWidget::create(['url' => $url])->run(); } }); @@ -63,19 +53,16 @@ $table->addAction(function ($row, $url) use ($moduleService){ $slug = $row['slug']; if ($moduleService->isInstall($slug)){ if (!$moduleService->isLastVersion($slug)) { - return ActionButtonWidget::create([ - 'btn_type' => "info", - 'label' => "", - 'url' => "$url/update/?slug=$slug", - ])->run(); + $url = "$url/update/?slug=" . $slug; + + return \kernel\widgets\IconBtn\IconBtnUpdateWidget::create(['url' => $url])->run(); } } return false; }); +\kernel\widgets\ModuleTabsWidget::create()->run(); $table->create(); - -\kernel\widgets\ModuleTabsWidget::create()->run(); $table->render(); diff --git a/kernel/modules/module_shop_client/views/view.php b/kernel/modules/module_shop_client/views/view.php index 05bcc51..6cd40ec 100644 --- a/kernel/modules/module_shop_client/views/view.php +++ b/kernel/modules/module_shop_client/views/view.php @@ -25,8 +25,7 @@ $table_info = [ $table = new \Itguild\Tables\ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); $table->beforePrint(function () { - $btn = PrimaryBtn::create("Список", "/admin/module_shop_client")->fetch(); - return $btn; + return \kernel\widgets\IconBtn\IconBtnListWidget::create(['url' => '/admin/module_shop_client'])->run(); }); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/modules/option/views/index.php b/kernel/modules/option/views/index.php index 00ad1fc..2523f35 100644 --- a/kernel/modules/option/views/index.php +++ b/kernel/modules/option/views/index.php @@ -11,6 +11,10 @@ use kernel\IGTabel\action_column\EditActionColumn; use kernel\IGTabel\action_column\ViewActionColumn; use kernel\IGTabel\btn\PrimaryBtn; use kernel\modules\option\models\Option; +use kernel\widgets\IconBtn\IconBtnCreateWidget; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnViewWidget; $table = new ListEloquentTable(new EloquentDataProvider(Option::class, [ 'current_page' => $page_number, @@ -20,8 +24,7 @@ $table = new ListEloquentTable(new EloquentDataProvider(Option::class, [ ])); $table->beforePrint(function () { - return PrimaryBtn::create("Создать", "/admin/option/create")->fetch(); - //return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch(); + return IconBtnCreateWidget::create(['url' => '/admin/option/create'])->run(); }); $table->columns([ @@ -31,8 +34,15 @@ $table->columns([ }] ]); -$table->addAction(ViewActionColumn::class); -$table->addAction(EditActionColumn::class); -$table->addAction(DeleteActionColumn::class); +$table->addAction(function($row) { + return IconBtnViewWidget::create(['url' => '/admin/option/view/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnEditWidget::create(['url' => '/admin/option/update/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $row['id']])->run(); +}); + $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/modules/option/views/view.php b/kernel/modules/option/views/view.php index b0e77b0..c9ee06e 100644 --- a/kernel/modules/option/views/view.php +++ b/kernel/modules/option/views/view.php @@ -8,15 +8,18 @@ use Itguild\EloquentTable\ViewJsonTableEloquentModel; use kernel\IGTabel\btn\DangerBtn; use kernel\IGTabel\btn\PrimaryBtn; use kernel\IGTabel\btn\SuccessBtn; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnListWidget; $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($option, [ 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/user", ])); $table->beforePrint(function () use ($option) { - $btn = PrimaryBtn::create("Список", "/admin/option")->fetch(); - $btn .= SuccessBtn::create("Редактировать", "/admin/option/update/" . $option->id)->fetch(); - $btn .= DangerBtn::create("Удалить", "/admin/option/delete/" . $option->id)->fetch(); + $btn = IconBtnListWidget::create(['url' => '/admin/option'])->run(); + $btn .= IconBtnEditWidget::create(['url' => '/admin/option/update/' . $option->id])->run(); + $btn .= IconBtnDeleteWidget::create(['url' => '/admin/option/delete/' . $option->id])->run(); return $btn; }); diff --git a/kernel/modules/post/views/index.php b/kernel/modules/post/views/index.php index 26eb926..65134cd 100644 --- a/kernel/modules/post/views/index.php +++ b/kernel/modules/post/views/index.php @@ -13,6 +13,10 @@ use kernel\modules\user\models\User; use Itguild\EloquentTable\EloquentDataProvider; use Itguild\EloquentTable\ListEloquentTable; use kernel\IGTabel\btn\PrimaryBtn; +use kernel\widgets\IconBtn\IconBtnCreateWidget; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnViewWidget; $table = new ListEloquentTable(new EloquentDataProvider(Post::class, [ 'currentPage' => $page_number, @@ -39,12 +43,18 @@ $table->columns([ return User::find($data)->username; }) ]); + $table->beforePrint(function () { - return PrimaryBtn::create("Создать", "/admin/post/create")->fetch(); - //return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch(); + return IconBtnCreateWidget::create(['url' => '/admin/post/create'])->run(); +}); +$table->addAction(function($row) { + return IconBtnViewWidget::create(['url' => '/admin/post/view/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnEditWidget::create(['url' => '/admin/post/update/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnDeleteWidget::create(['url' => '/admin/post/delete/' . $row['id']])->run(); }); -$table->addAction(ViewActionColumn::class); -$table->addAction(EditActionColumn::class); -$table->addAction(DeleteActionColumn::class); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/modules/post/views/view.php b/kernel/modules/post/views/view.php index 13837b1..36a61f6 100644 --- a/kernel/modules/post/views/view.php +++ b/kernel/modules/post/views/view.php @@ -10,17 +10,21 @@ use Itguild\EloquentTable\ViewJsonTableEloquentModel; use kernel\IGTabel\btn\DangerBtn; use kernel\IGTabel\btn\PrimaryBtn; use kernel\IGTabel\btn\SuccessBtn; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnListWidget; $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($content, [ 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/post", ])); $table->beforePrint(function () use ($content) { - $btn = PrimaryBtn::create("Список", "/admin/post")->fetch(); - $btn .= SuccessBtn::create("Редактировать", "/admin/post/update/" . $content->id)->fetch(); - $btn .= DangerBtn::create("Удалить", "/admin/post/delete/" . $content->id)->fetch(); + $btn = IconBtnListWidget::create(['url' => '/admin/post'])->run(); + $btn .= IconBtnEditWidget::create(['url' => '/admin/post/update/' . $content->id])->run(); + $btn .= IconBtnDeleteWidget::create(['url' => '/admin/post/delete/' . $content->id])->run(); return $btn; }); + $table->rows([ 'created_at' => function ($data) { if (!$data){ diff --git a/kernel/modules/user/views/index.php b/kernel/modules/user/views/index.php index 5876e6c..ef5976c 100644 --- a/kernel/modules/user/views/index.php +++ b/kernel/modules/user/views/index.php @@ -12,6 +12,10 @@ use kernel\IGTabel\action_column\EditActionColumn; use kernel\IGTabel\action_column\ViewActionColumn; use kernel\IGTabel\btn\PrimaryBtn; use kernel\modules\user\models\User; +use kernel\widgets\IconBtn\IconBtnCreateWidget; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnViewWidget; $table = new ListEloquentTable(new EloquentDataProvider(User::class, [ 'currentPage' => $page_number, @@ -42,11 +46,16 @@ $table->columns([ } ]); $table->beforePrint(function () { - return PrimaryBtn::create("Создать", "/admin/user/create")->fetch(); - //return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch(); + return IconBtnCreateWidget::create(['url' => '/admin/user/create'])->run(); +}); +$table->addAction(function($row) { + return IconBtnViewWidget::create(['url' => '/admin/user/view/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnEditWidget::create(['url' => '/admin/user/update/' . $row['id']])->run(); +}); +$table->addAction(function($row) { + return IconBtnDeleteWidget::create(['url' => '/admin/user/delete/' . $row['id']])->run(); }); -$table->addAction(ViewActionColumn::class); -$table->addAction(EditActionColumn::class); -$table->addAction(DeleteActionColumn::class); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/modules/user/views/view.php b/kernel/modules/user/views/view.php index fc8293b..5cab5ea 100644 --- a/kernel/modules/user/views/view.php +++ b/kernel/modules/user/views/view.php @@ -10,17 +10,21 @@ use Itguild\EloquentTable\ViewJsonTableEloquentModel; use kernel\IGTabel\btn\DangerBtn; use kernel\IGTabel\btn\PrimaryBtn; use kernel\IGTabel\btn\SuccessBtn; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnEditWidget; +use kernel\widgets\IconBtn\IconBtnListWidget; $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($user, [ 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/user", ])); $table->beforePrint(function () use ($user) { - $btn = PrimaryBtn::create("Список", "/admin/user")->fetch(); - $btn .= SuccessBtn::create("Редактировать", "/admin/user/update/" . $user->id)->fetch(); - $btn .= DangerBtn::create("Удалить", "/admin/user/delete/" . $user->id)->fetch(); + $btn = IconBtnListWidget::create(['url' => '/admin/user'])->run(); + $btn .= IconBtnEditWidget::create(['url' => '/admin/user/update/' . $user->id])->run(); + $btn .= IconBtnDeleteWidget::create(['url' => '/admin/user/delete/' . $user->id])->run(); return $btn; }); + $table->rows([ 'created_at' => function ($data) { if (!$data){ diff --git a/kernel/views/module/index.php b/kernel/views/module/index.php index b1d887d..e06835b 100644 --- a/kernel/views/module/index.php +++ b/kernel/views/module/index.php @@ -7,7 +7,11 @@ * @var \kernel\services\ModuleService $moduleService */ -use kernel\widgets\ActionButtonWidget; +use kernel\widgets\IconBtn\IconBtnActivateWidget; +use kernel\widgets\IconBtn\IconBtnDeactivateWidget; +use kernel\widgets\IconBtn\IconBtnDeleteWidget; +use kernel\widgets\IconBtn\IconBtnUpdateWidget; +use kernel\widgets\IconBtn\IconBtnViewWidget; use kernel\widgets\ModuleTabsWidget; $meta = []; @@ -32,40 +36,28 @@ $table = new \Itguild\Tables\ListJsonTable(json_encode($info_to_table, JSON_PRET $table->addAction(function ($row, $url) use ($moduleService) { $slug = $row['slug']; if ($moduleService->isActive($slug)) { - return ActionButtonWidget::create([ - 'btn_type' => "warning", - 'label' => "", - 'url' => "$url/deactivate/?slug=$slug", - ])->run(); + $url = "$url/deactivate/?slug=". $row['slug']; + return IconBtnDeactivateWidget::create(['url' => $url])->run(); } else { - return ActionButtonWidget::create([ - 'label' => "", - 'url' => "$url/deactivate/?slug=$slug", - 'btn_type' => "success" - ])->run(); + $url = "$url/activate/?slug=". $row['slug']; + + return IconBtnActivateWidget::create(['url' => $url])->run(); } }); -$table->addAction(function ($row, $url) use ($moduleService) { - $slug = $row['slug']; +$table->addAction(function ($row, $url) { + $url = "$url/view/?slug=". $row['slug']; - return ActionButtonWidget::create([ - 'btn_type' => "primary", - 'label' => "", - 'url' => "$url/view/?slug=$slug", - ])->run(); + return IconBtnViewWidget::create(['url' => $url])->run(); }); $table->addAction(function ($row, $url) use ($moduleService){ - $slug = $row['slug']; - if (!$moduleService->isKernelModule($slug)){ - if (!$moduleService->isLastVersion($slug)) { - return ActionButtonWidget::create([ - 'btn_type' => "info", - 'label' => "", - 'url' => "$url/view/?slug=$slug", - ])->run(); + if (!$moduleService->isKernelModule($row['slug'])){ + if (!$moduleService->isLastVersion($row['slug'])) { + $url = "$url/update/?slug=". $row['slug']; + + return IconBtnUpdateWidget::create(['url' => $url])->run(); } } @@ -75,11 +67,9 @@ $table->addAction(function ($row, $url) use ($moduleService){ $table->addAction(function ($row) use ($moduleService){ $slug = $row['slug']; if (!$moduleService->isKernelModule($slug)) { - return ActionButtonWidget::create([ - 'btn_type' => "danger", - 'label' => "", - 'url' => "admin/module_shop_client/delete/?slug=$slug", - ])->run(); + $url = "admin/module_shop_client/delete/?slug=" . $row['slug']; + + return IconBtnDeleteWidget::create(['url' => $url])->run(); } return false; }); diff --git a/kernel/views/module/view.php b/kernel/views/module/view.php index 168fcf9..ba9e5eb 100644 --- a/kernel/views/module/view.php +++ b/kernel/views/module/view.php @@ -3,9 +3,8 @@ * @var array $data */ -use kernel\IGTabel\btn\DangerBtn; -use kernel\IGTabel\btn\PrimaryBtn; -use kernel\IGTabel\btn\SuccessBtn; +use Itguild\Tables\ViewJsonTable; +use kernel\widgets\IconBtn\IconBtnListWidget; $table_info = [ "meta" => [ @@ -20,11 +19,10 @@ $table_info = [ ], "data" => $data ]; -$table = new \Itguild\Tables\ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); +$table = new ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); $table->beforePrint(function () { - $btn = PrimaryBtn::create("Список", "/admin")->fetch(); - return $btn; + return IconBtnListWidget::create(['url' => '/admin'])->run(); }); $table->create(); $table->render(); \ No newline at end of file diff --git a/kernel/views/widgets/action_button.php b/kernel/views/widgets/action_button.php index 918d5ac..b58234d 100644 --- a/kernel/views/widgets/action_button.php +++ b/kernel/views/widgets/action_button.php @@ -3,7 +3,8 @@ * @var string $label * @var string $btn_type * @var string $url + * @var string $title */ ?> - \ No newline at end of file + \ No newline at end of file diff --git a/kernel/widgets/ActionButtonWidget.php b/kernel/widgets/ActionButtonWidget.php index d13148a..13d57d1 100644 --- a/kernel/widgets/ActionButtonWidget.php +++ b/kernel/widgets/ActionButtonWidget.php @@ -18,7 +18,8 @@ class ActionButtonWidget extends Widget $label = $this->data['label']; $btn_type = $this->data['btn_type']; $url = $this->data['url']; + $title = $this->data['title'] ?? ''; - return $this->cgView->fetch('/action_button.php', ['label' => $label, 'btn_type' => $btn_type, 'url' => $url]); + return $this->cgView->fetch('/action_button.php', ['label' => $label, 'btn_type' => $btn_type, 'url' => $url, 'title' => $title]); } } \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnActivateWidget.php b/kernel/widgets/IconBtn/IconBtnActivateWidget.php new file mode 100644 index 0000000..2665265 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnActivateWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "success", + 'title' => "Активировать" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnCreateWidget.php b/kernel/widgets/IconBtn/IconBtnCreateWidget.php new file mode 100644 index 0000000..da3d462 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnCreateWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "success", + 'title' => "Создать" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnDeactivateWidget.php b/kernel/widgets/IconBtn/IconBtnDeactivateWidget.php new file mode 100644 index 0000000..005bfbd --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnDeactivateWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "warning", + 'title' => "Деактивировать" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnDeleteWidget.php b/kernel/widgets/IconBtn/IconBtnDeleteWidget.php new file mode 100644 index 0000000..e8ba1d0 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnDeleteWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "danger", + 'title' => "Удалить" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnEditWidget.php b/kernel/widgets/IconBtn/IconBtnEditWidget.php new file mode 100644 index 0000000..cdf9406 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnEditWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "success", + 'title' => "Редактировать" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnInstallWidget.php b/kernel/widgets/IconBtn/IconBtnInstallWidget.php new file mode 100644 index 0000000..7a09f39 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnInstallWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "success", + 'title' => "Установить" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnListWidget.php b/kernel/widgets/IconBtn/IconBtnListWidget.php new file mode 100644 index 0000000..e0e0f06 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnListWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "primary", + 'title' => "Список" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnUpdateWidget.php b/kernel/widgets/IconBtn/IconBtnUpdateWidget.php new file mode 100644 index 0000000..b421009 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnUpdateWidget.php @@ -0,0 +1,26 @@ +data['url']; + + return ActionButtonWidget::create([ + 'label' => "", + 'url' => $url, + 'btn_type' => "info", + 'title' => "Обновить" + ])->run(); + } +} \ No newline at end of file diff --git a/kernel/widgets/IconBtn/IconBtnViewWidget.php b/kernel/widgets/IconBtn/IconBtnViewWidget.php new file mode 100644 index 0000000..73ee3d8 --- /dev/null +++ b/kernel/widgets/IconBtn/IconBtnViewWidget.php @@ -0,0 +1,27 @@ +data['url']; + + return ActionButtonWidget::create([ + 'btn_type' => "primary", + 'label' => "", + 'url' => $url, + 'title' => "Просмотреть" + ])->run(); + } + +} \ No newline at end of file