sheillendra/yii2-adminlte

There is no license information available for the latest version (1.0.0-alpha) of this package.

Yii2 AdminLTE

Installs: 94

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 4

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0.0-alpha 2017-08-30 10:18 UTC

This package is not auto-updated.

Last update: 2024-12-21 20:30:26 UTC


README

Implement AdminLTE

installation

composer require "sheillendra/yii2-adminlte": "dev-master"

config main.php

components => [
    'view' => [
        'theme' => [
            'pathMap' => [
                '@app/views' => [
                    '@backend/themes/adminlte/views',
                    '@sheillendra/adminlte/views',
                ],
                '@app/modules' => [
                    '@backend/themes/adminlte/modules',
                    '@sheillendra/adminlte/modules',
                ],
                '@app/widgets' => [
                    '@backend/themes/adminlte/widgets',
                    '@sheillendra/adminlte/widgets',
                ]
            ],
        ],
    ],
],
//for to see default view example, uncoment config below
/*
'controllerMap' => [
    'admin-lte' => 'sheillendra\adminlte\controllers\AdminLteController'
],
*/

stop here and run your aplication, you can see the default implement of adminlte theme.

Gii

This extension come with gii. Once the extension is installed, simply modify your application configuration as follows:

// /config/main-local.php        for yii2-app-advanced
// /config/web.php               for yii2-basic
...
if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment 
    ...
    
    $config['modules']['gii'] = [
        'class'=>'yii\gii\Module',
       'generators' =>[
           'adminlte-crud' => ['class'=>'sheillendra\adminlte\gii\generators\crud\Generator']
        ]
    ];
}

custom

Run CRUD GII you will get sample code to custom

components

grid

change your index view from gii result :

<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\MenusSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Menus Cruds');
$this->params['breadcrumbs'][] = $this->title;
$this->params['selectedSidebar'] = 'menu';
?>
<div class="menus-crud-index">
    <?php
    echo $this->render('@sheillendra/adminlte/views/_partials/grid', [
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'caption' => $this->title,
        'tools' => Html::a(
                Yii::t('app', 'Create Menu')
                , ['create']
                , ['class' => 'btn btn-success btn-sm']
        ),
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'id',
            'label',
            'url:url',
            'options',
            'parent_id',
            // 'icon',
            // 'visible',
            // 'created_at',
            // 'created_by',
            // 'updated_at',
            // 'updated_by',
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]);
    ?>
</div>