grozzzny/admin

Admin module for Yii2

Installs: 97

Dependents: 2

Suggesters: 0

Security: 0

Stars: 3

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2022-05-24 10:32 UTC

This package is auto-updated.

Last update: 2024-10-24 15:44:37 UTC


README

This module allows to yiiframework Dashboard Bootstrap 4. Dashboard demo

alt text

Live edit and admin navbar

alt text

CRUD gii

alt text

Installation guide

$ php composer.phar require grozzzny/admin "dev-master"

Configure

NOTE: Make sure that you don't have admin component configuration in your config files.

Add following lines to your main configuration file:

$config = [
    ...
    'controllerMap' => [
         'feedback' => [
             'class' => 'grozzzny\admin\modules\feedback\widgets\form\controllers\DefaultController',
             'on submit' => ['grozzzny\admin\modules\feedback\widgets\form\components\SubmitHandler', 'submit']
         ]
    ],
    ...
    'modules' => [
        ...
         // https://imperavi.com/redactor/docs/settings/
         'redactor' => [
             'class' => 'yii\redactor\RedactorModule',
              'as access' => [
                  'class' => 'grozzzny\admin\behaviors\AccessControl',
              ],
             'uploadDir' => '@webroot/uploads',
             'uploadUrl' => '@web/uploads',
             'imageAllowExtensions'=>['jpg','png','gif']
         ],
        'admin' => [
            'class' => 'grozzzny\admin\AdminModule',
             'as access' => [
                 'class' => 'grozzzny\admin\behaviors\AccessControl',
             ],
             'live_edit_role' => '@',
             'render_toolbar_role' => '@',
             'view_path_toolbar' => '@grozzzny/admin/views/layouts/_toolbar',
             'nav_items' => [
                 [
                     'label' => 'Начальная',
                     'url' => ['/admin/default']
                 ],
                 [
                     'label' => 'Страницы',
                     'url' => ['/admin/pages/default']
                 ],
                 [
                     'label' => 'Текстовые блоки',
                     'url' => ['/admin/text/default']
                 ],
                 [
                     'label' => 'Преимущества',
                     'url' => ['/admin/features/default']
                 ],
                 [
                     'label' => 'Отзывы',
                     'url' => ['/admin/testimonials/default']
                 ],
                 [
                     'label' => 'Обратный звонок',
                     'url' => ['/admin/feedback/default']
                 ],
                 [
                     'label' => 'Ссылки соц. сетей',
                     'url' => ['/admin/social_links/default']
                 ],
                 [
                     'label' => 'Dashboard demo',
                     'url' => 'https://www.bootstrapdash.com/demo/star-admin-free/jquery/src/demo_1/index.html',
                 ]
             ],
             'classMap' => [
                 //'AdminPages' => 'app\models\AdminPages',
                 //'AdminSeo' => 'app\models\AdminSeo',
             ],
             'modules' => [
                 'text' => [
                     'class' => 'grozzzny\admin\modules\text\TextModule',
                 ],
                 'features' => [
                     'class' => 'grozzzny\admin\modules\features\FeaturesModule',
                 ],
                 'testimonials' => [
                     'class' => 'grozzzny\admin\modules\testimonials\TestimonialsModule',
                 ],
                 'feedback' => [
                     'class' => 'grozzzny\admin\modules\feedback\FeedbackModule',
                 ],
                 'social_links' => [
                     'class' => 'grozzzny\admin\modules\social_links\SocialLinksModule',
                 ],
                 'pages' => [
                     'class' => 'grozzzny\admin\modules\pages\PagesModule',
                 ],
             ],
        ],
        ...
    ],
    ...
    'params' => [
       'adminEmail' => 'admin@example.com',
       'senderEmail' => 'noreply@example.com',
       'senderName' => 'Example.com mailer',
       'noimage' => '/images/noimage.jpg',
    ],
    ...
];

$config['modules']['gii'] = [
    'class'      => 'yii\gii\Module',
    'generators' => [
        'crud'   => [
            'class'     => 'yii\gii\generators\crud\Generator',
            'templates' => [
                'admin' => '@grozzzny/admin/templates/crud'
            ]
        ]
    ]
];

Add following lines to your console configuration file:

'controllerMap' => [
    'migrate' => [
        'class' => 'yii\console\controllers\MigrateController',
        'migrationPath' => [
            '@grozzzny/admin/migrations',
        ],
    ],
],

Run migrations

php yii migrate

Example module pages with SEO behavior (Polymorphic relationship)

alt text