module tabs widget
This commit is contained in:
parent
825d3df776
commit
9a152885d8
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\module_shop_client;
|
||||
|
||||
use kernel\Module;
|
||||
use kernel\modules\menu\service\MenuService;
|
||||
|
||||
class ModuleShopClientModule extends Module
|
||||
{
|
||||
public MenuService $menuService;
|
||||
public function __construct()
|
||||
{
|
||||
$this->menuService = new MenuService();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function init(): void
|
||||
{
|
||||
$this->menuService->createItem([
|
||||
"label" => "Магазин модулей",
|
||||
"url" => "/admin/module_shop_client",
|
||||
"slug" => "module_shop_client",
|
||||
]);
|
||||
}
|
||||
|
||||
public function deactivate(): void
|
||||
{
|
||||
$this->menuService->removeItemBySlug("module_shop_client");
|
||||
}
|
||||
}
|
@ -4,8 +4,6 @@
|
||||
"author": "ITGuild",
|
||||
"slug": "module_shop_client",
|
||||
"description": "Module shop client module",
|
||||
"module_class": "kernel\\modules\\module_shop_client\\ModuleShopClientModule",
|
||||
"module_class_file": "{KERNEL_MODULES}/module_shop_client/ModuleShopClientModule.php",
|
||||
"routs": "routs/module_shop_client.php",
|
||||
"migration_path": "migrations",
|
||||
"dependence": "menu"
|
||||
|
@ -50,4 +50,6 @@ $table->addAction(function ($row, $url) use ($moduleService){
|
||||
|
||||
|
||||
$table->create();
|
||||
|
||||
\kernel\widgets\ModuleTabsWidget::create()->run();
|
||||
$table->render();
|
||||
|
@ -54,16 +54,7 @@ $table->addAction(function ($row, $url) use ($moduleService) {
|
||||
|
||||
$table->create();
|
||||
|
||||
|
||||
?>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Локальные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Каталог</a>
|
||||
</li>
|
||||
</ul>
|
||||
<br>
|
||||
<?php
|
||||
if ($moduleService->isActive('module_shop_client')) {
|
||||
\kernel\widgets\ModuleTabsWidget::create()->run();
|
||||
}
|
||||
$table->render();
|
||||
|
@ -23,7 +23,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")->fetch();
|
||||
$btn = PrimaryBtn::create("Список", "/admin")->fetch();
|
||||
return $btn;
|
||||
});
|
||||
$table->create();
|
||||
|
18
kernel/widgets/ModuleTabsWidget.php
Normal file
18
kernel/widgets/ModuleTabsWidget.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\widgets;
|
||||
|
||||
use kernel\helpers\Debug;
|
||||
use kernel\Widget;
|
||||
|
||||
class ModuleTabsWidget extends Widget
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$tabs = [
|
||||
'/admin' => 'Локальные',
|
||||
'/admin/module_shop_client' => 'Каталог'
|
||||
];
|
||||
$this->cgView->render('/admin/module_tabs.php', ['tabs' => $tabs]);
|
||||
}
|
||||
}
|
14
views/widgets/admin/module_tabs.php
Normal file
14
views/widgets/admin/module_tabs.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* @var array $tabs
|
||||
*/
|
||||
?>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
<?php foreach ($tabs as $link => $label): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?=\kernel\Request::getUrlPath() === $link ? "active" : " "?>" href="<?= $link ?>" > <?= $label ?></a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<br>
|
Loading…
Reference in New Issue
Block a user