admin themes
This commit is contained in:
29
kernel/modules/admin_themes/views/index.php
Normal file
29
kernel/modules/admin_themes/views/index.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* @var $json string
|
||||
*/
|
||||
|
||||
use app\helpers\Debug;
|
||||
use Itguild\EloquentTable\EloquentDataProvider;
|
||||
use Itguild\EloquentTable\ListEloquentTable;
|
||||
use kernel\models\Option;
|
||||
|
||||
|
||||
$table = new \Itguild\Tables\ListJsonTable($json);
|
||||
$table->columns([
|
||||
'preview' => function ($data) {
|
||||
return "<img src='$data' width='200px'>";
|
||||
}
|
||||
]);
|
||||
$table->addAction(function ($row, $url){
|
||||
$path = $row['path'];
|
||||
$active_admin_theme = Option::where("key", "active_admin_theme")->first();
|
||||
$btn = "<a class='btn btn-primary' href='$url/activate/?p=$path' style='margin: 3px; width: 150px;' >Активировать</a>";;
|
||||
if ($path === $active_admin_theme->value){
|
||||
$btn = "Активна";
|
||||
}
|
||||
|
||||
return $btn;
|
||||
});
|
||||
$table->create();
|
||||
$table->render();
|
30
kernel/modules/admin_themes/views/view.php
Normal file
30
kernel/modules/admin_themes/views/view.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @var array $data
|
||||
*/
|
||||
|
||||
use kernel\IGTabel\btn\DangerBtn;
|
||||
use kernel\IGTabel\btn\PrimaryBtn;
|
||||
use kernel\IGTabel\btn\SuccessBtn;
|
||||
|
||||
$table_info = [
|
||||
"meta" => [
|
||||
"rows" => ["preview" => "Превью", "name" => "Название", "version" => "Версия", "description" => "Описание"],
|
||||
"params" => ["class" => "table table-bordered"],
|
||||
"baseUrl" => "/admin/settings/admin-themes",
|
||||
],
|
||||
"data" => $data
|
||||
];
|
||||
|
||||
$table = new \Itguild\Tables\ViewJsonTable(json_encode($table_info, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
$table->rows([
|
||||
'preview' => function ($data) {
|
||||
return "<img src='$data' width='500px'>";
|
||||
}
|
||||
]);
|
||||
$table->beforePrint(function () {
|
||||
$btn = PrimaryBtn::create("Список", "/admin/settings/admin-themes")->fetch();
|
||||
return $btn;
|
||||
});
|
||||
$table->create();
|
||||
$table->render();
|
Reference in New Issue
Block a user