preview 1
This commit is contained in:
parent
62ccfceb46
commit
9d84aeb307
4
config/routes/easyadmin.yaml
Normal file
4
config/routes/easyadmin.yaml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# config/routes/easyadmin.yaml
|
||||||
|
easyadmin:
|
||||||
|
resource: .
|
||||||
|
type: easyadmin.routes
|
BIN
public/img/versions.webp
Normal file
BIN
public/img/versions.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 89 KiB |
|
@ -2,19 +2,22 @@
|
||||||
|
|
||||||
namespace App\Controller\Admin;
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
|
use App\Entity\Post;
|
||||||
|
use App\Entity\Tree;
|
||||||
|
use App\Entity\User;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Locale;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Dto\LocaleDto;
|
|
||||||
|
|
||||||
class DashboardController extends AbstractDashboardController
|
class DashboardController extends AbstractDashboardController
|
||||||
{
|
{
|
||||||
#[Route('/admin', name: 'admin')]
|
#[Route('/admin/{_locale}', name: 'admin')]
|
||||||
public function index(): Response
|
public function index($_locale = 'fa'): Response
|
||||||
{
|
{
|
||||||
return parent::index();
|
//return parent::index();
|
||||||
|
|
||||||
// Option 1. You can make your dashboard redirect to some common page of your backend
|
// Option 1. You can make your dashboard redirect to some common page of your backend
|
||||||
//
|
//
|
||||||
|
@ -30,43 +33,28 @@ class DashboardController extends AbstractDashboardController
|
||||||
// Option 3. You can render some custom template to display a proper dashboard with widgets, etc.
|
// Option 3. You can render some custom template to display a proper dashboard with widgets, etc.
|
||||||
// (tip: it's easier if your template extends from @EasyAdmin/page/content.html.twig)
|
// (tip: it's easier if your template extends from @EasyAdmin/page/content.html.twig)
|
||||||
//
|
//
|
||||||
// return $this->render('some/path/my-dashboard.html.twig');
|
return $this->render('admin/dashboard.html.twig');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureDashboard(): Dashboard
|
public function configureDashboard(): Dashboard
|
||||||
{
|
{
|
||||||
return Dashboard::new()
|
return Dashboard::new()
|
||||||
// the name visible to end users
|
|
||||||
->setTitle('ACME Corp.')
|
|
||||||
// you can include HTML contents too (e.g. to link to an image)
|
// you can include HTML contents too (e.g. to link to an image)
|
||||||
->setTitle('<img src="..."> ACME <span class="text-small">Corp.</span>')
|
->setTitle('پیشخوان')
|
||||||
|
|
||||||
// by default EasyAdmin displays a black square as its default favicon;
|
// by default EasyAdmin displays a black square as its default favicon;
|
||||||
// use this method to display a custom favicon: the given path is passed
|
// use this method to display a custom favicon: the given path is passed
|
||||||
// "as is" to the Twig asset() function:
|
// "as is" to the Twig asset() function:
|
||||||
// <link rel="shortcut icon" href="{{ asset('...') }}">
|
// <link rel="shortcut icon" href="{{ asset('...') }}">
|
||||||
->setFaviconPath('favicon.svg')
|
->setFaviconPath('favicon/favicon.ico')
|
||||||
|
|
||||||
// the domain used by default is 'messages'
|
// the domain used by default is 'messages'
|
||||||
->setTranslationDomain('my-custom-domain')
|
->setTranslationDomain('admin')
|
||||||
|
|
||||||
// there's no need to define the "text direction" explicitly because
|
|
||||||
// its default value is inferred dynamically from the user locale
|
|
||||||
->setTextDirection('ltr')
|
|
||||||
|
|
||||||
// set this option if you prefer the page content to span the entire
|
// set this option if you prefer the page content to span the entire
|
||||||
// browser width, instead of the default design which sets a max width
|
// browser width, instead of the default design which sets a max width
|
||||||
->renderContentMaximized()
|
->renderContentMaximized()
|
||||||
|
|
||||||
// set this option if you prefer the sidebar (which contains the main menu)
|
|
||||||
// to be displayed as a narrow column instead of the default expanded design
|
|
||||||
->renderSidebarMinimized()
|
|
||||||
|
|
||||||
// by default, users can select between a "light" and "dark" mode for the
|
|
||||||
// backend interface. Call this method if you prefer to disable the "dark"
|
|
||||||
// mode for any reason (e.g. if your interface customizations are not ready for it)
|
|
||||||
->disableDarkMode()
|
|
||||||
|
|
||||||
// by default, the UI color scheme is 'auto', which means that the backend
|
// by default, the UI color scheme is 'auto', which means that the backend
|
||||||
// will use the same mode (light/dark) as the operating system and will
|
// will use the same mode (light/dark) as the operating system and will
|
||||||
// change in sync when the OS mode changes.
|
// change in sync when the OS mode changes.
|
||||||
|
@ -79,12 +67,25 @@ class DashboardController extends AbstractDashboardController
|
||||||
// by default, all backend URLs are generated as absolute URLs. If you
|
// by default, all backend URLs are generated as absolute URLs. If you
|
||||||
// need to generate relative URLs instead, call this method
|
// need to generate relative URLs instead, call this method
|
||||||
->generateRelativeUrls()
|
->generateRelativeUrls()
|
||||||
|
|
||||||
|
->setLocales(['en','fa'])
|
||||||
|
// to further customize the locale option, pass an instance of
|
||||||
|
// EasyCorp\Bundle\EasyAdminBundle\Config\Locale
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureMenuItems(): iterable
|
public function configureMenuItems(): iterable
|
||||||
{
|
{
|
||||||
yield MenuItem::linkToDashboard('Dashboard', 'fa fa-home');
|
return [
|
||||||
// yield MenuItem::linkToCrud('The Label', 'fas fa-list', EntityClass::class);
|
MenuItem::linkToDashboard('پیشخوان', 'fa fa-home'),
|
||||||
|
|
||||||
|
MenuItem::section('پست بلاگ'),
|
||||||
|
MenuItem::linkToCrud('دسته بندی', 'fa fa-tags', Tree::class),
|
||||||
|
MenuItem::linkToCrud('محتوا', 'fa fa-file-text', Post::class),
|
||||||
|
|
||||||
|
MenuItem::section('کاربران'),
|
||||||
|
MenuItem::linkToCrud('کاربران', 'fa fa-user', User::class),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
namespace App\Controller\Admin;
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
use App\Entity\Post;
|
use App\Entity\Post;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||||
|
|
||||||
|
@ -15,14 +17,22 @@ class PostCrudController extends AbstractCrudController
|
||||||
return Post::class;
|
return Post::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public function configureFields(string $pageName): iterable
|
public function configureFields(string $pageName): iterable
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
IdField::new('id'),
|
TextField::new('title', 'عنوان'),
|
||||||
TextField::new('title'),
|
TextareaField::new('intro', 'خلاصه مطلب'),
|
||||||
TextEditorField::new('description'),
|
TextEditorField::new('body', 'متن'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
public function configureCrud(Crud $crud): Crud
|
||||||
|
{
|
||||||
|
return $crud
|
||||||
|
// the labels used to refer to this entity in titles, buttons, etc.
|
||||||
|
->setEntityLabelInSingular('محتوا')
|
||||||
|
->setEntityLabelInPlural('محتواها')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
28
src/Controller/Admin/TreeCrudController.php
Normal file
28
src/Controller/Admin/TreeCrudController.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
|
use App\Entity\Tree;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||||
|
|
||||||
|
class TreeCrudController extends AbstractCrudController
|
||||||
|
{
|
||||||
|
public static function getEntityFqcn(): string
|
||||||
|
{
|
||||||
|
return Tree::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function configureFields(string $pageName): iterable
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
IdField::new('id'),
|
||||||
|
TextField::new('title'),
|
||||||
|
TextEditorField::new('description'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
28
src/Controller/Admin/UserCrudController.php
Normal file
28
src/Controller/Admin/UserCrudController.php
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
|
use App\Entity\User;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||||
|
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||||
|
|
||||||
|
class UserCrudController extends AbstractCrudController
|
||||||
|
{
|
||||||
|
public static function getEntityFqcn(): string
|
||||||
|
{
|
||||||
|
return User::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function configureFields(string $pageName): iterable
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
IdField::new('id'),
|
||||||
|
TextField::new('title'),
|
||||||
|
TextEditorField::new('description'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
|
@ -93,4 +93,13 @@ class PageController extends AbstractController
|
||||||
'trees' => $tress,
|
'trees' => $tress,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('/changes', name: 'app_changes')]
|
||||||
|
public function app_changes(EntityManagerInterface $entityManagerInterface): Response
|
||||||
|
{
|
||||||
|
$posts = $entityManagerInterface->getRepository(Post::class)->findAllByCat('changelog');
|
||||||
|
return $this->render('post/versions.html.twig', [
|
||||||
|
'items' => $posts,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,4 +58,16 @@ class PostRepository extends ServiceEntityRepository
|
||||||
->getResult()
|
->getResult()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findAllBycat($cat = 'blog'): array
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('p')
|
||||||
|
->innerJoin('p.cat', 'c')
|
||||||
|
->where('c.code = :cat')
|
||||||
|
->setParameter('cat', $cat)
|
||||||
|
->orderBy('p.dateSubmit', 'DESC')
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
1
templates/admin/dashboard.html.twig
Normal file
1
templates/admin/dashboard.html.twig
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{% extends '@EasyAdmin/layout.html.twig' %}
|
|
@ -78,6 +78,9 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{path('app_api_docs',{'url':'home'})}}" class="nav-link px-2">مستندات API</a>
|
<a href="{{path('app_api_docs',{'url':'home'})}}" class="nav-link px-2">مستندات API</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="{{path('app_changes')}}" class="nav-link px-2">تغییرات</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://github.com/morrning" target="_blank" class="nav-link px-2">مخازن کد</a>
|
<a href="https://github.com/morrning" target="_blank" class="nav-link px-2">مخازن کد</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -2,12 +2,21 @@
|
||||||
<urlset
|
<urlset
|
||||||
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
|
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
|
||||||
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
|
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
|
||||||
<!-- created with Free Online Sitemap Generator www.xml-sitemaps.com -->
|
|
||||||
<url>
|
<url>
|
||||||
<loc>{{ absolute_url(path('app_home')) }}</loc>
|
<loc>{{ absolute_url(path('app_home')) }}</loc>
|
||||||
<lastmod>2025-01-09T06:58:03+00:00</lastmod>
|
<lastmod>2025-01-09T06:58:03+00:00</lastmod>
|
||||||
<priority>1.00</priority>
|
<priority>1.00</priority>
|
||||||
</url>
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>{{ absolute_url(path('app_changes')) }}</loc>
|
||||||
|
<lastmod>2025-01-09T06:58:03+00:00</lastmod>
|
||||||
|
<priority>1.00</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>{{ absolute_url(path('app_blog_home')) }}</loc>
|
||||||
|
<lastmod>2025-01-09T06:58:03+00:00</lastmod>
|
||||||
|
<priority>1.00</priority>
|
||||||
|
</url>
|
||||||
{% for post in posts %}
|
{% for post in posts %}
|
||||||
{% if post.cat.code == 'plain' %}
|
{% if post.cat.code == 'plain' %}
|
||||||
<url>
|
<url>
|
||||||
|
@ -21,6 +30,18 @@
|
||||||
<lastmod>{{ twigFunctions.getctime(post.dateSubmit) }}</lastmod>
|
<lastmod>{{ twigFunctions.getctime(post.dateSubmit) }}</lastmod>
|
||||||
<priority>1.00</priority>
|
<priority>1.00</priority>
|
||||||
</url>
|
</url>
|
||||||
|
{% elseif post.cat.code == 'guide' %}
|
||||||
|
<url>
|
||||||
|
<loc>{{ absolute_url(path('app_guide',{'url':post.url})) }}</loc>
|
||||||
|
<lastmod>{{ twigFunctions.getctime(post.dateSubmit) }}</lastmod>
|
||||||
|
<priority>1.00</priority>
|
||||||
|
</url>
|
||||||
|
{% elseif post.cat.code == 'api' %}
|
||||||
|
<url>
|
||||||
|
<loc>{{ absolute_url(path('app_api_docs',{'url':post.url})) }}</loc>
|
||||||
|
<lastmod>{{ twigFunctions.getctime(post.dateSubmit) }}</lastmod>
|
||||||
|
<priority>1.00</priority>
|
||||||
|
</url>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</urlset>
|
</urlset>
|
||||||
|
|
26
templates/post/versions.html.twig
Normal file
26
templates/post/versions.html.twig
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
{% block keywords %}item.keywords
|
||||||
|
{% endblock %}
|
||||||
|
{% block title %}
|
||||||
|
تاریخچه تغییرات حسابیکس
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block des %}
|
||||||
|
تاریخچه تغییرات حسابیکس
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="container p-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 mb-2">
|
||||||
|
<img src="{{ asset('/img/versions.webp')}}" class="img-fluid rounded-3 shadow" style="max-height:23rem;" />
|
||||||
|
</div>
|
||||||
|
{% for item in items %}
|
||||||
|
<div class="col-12 mb-2">
|
||||||
|
<h1 class="text-primary fs-3">{{ item.title }}</h1>
|
||||||
|
<p class="">{{ item.body | raw }}</p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue