Adminlte widgets, helpers and gii for yii2, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist wokster/yii2-adminlte-widgets "*"
or add, (*4)
"wokster/yii2-adminlte-widgets": "*"
to the require section of your composer.json
file., (*5)
Usage
Use BoxWidget to add your content in adminLTE box
full config:, (*6)
'Some title', //string
'border' => false, //boolean
'color' => 'default', //bootstrap color name 'success', 'danger' еtс.
'solid' => false, //boolean
'padding' => true, //boolean
'footer' => false, //boolean or html to render footer
'collapse' => true, //boolean Default AdminLTE button for collapse box
'close' => false, //boolean Default AdminLTE button for remove box
'hide' => false, //boolean collapsed or not
'buttons' => [ //array with config to add custom buttons or links
//sample for links, like in default gii view template
['link', '',['delete', 'id' => $model->id],[
'data-toggle'=>'tooltip', 'data-original-title'=>'delete it',
'data' => [
'confirm' => 'Вы уверены, что хотите безвозвратно удалить партнера?',
'method' => 'post',
],]],
['link', '',['update','id' => $model->id],['data-toggle'=>'tooltip', 'data-original-title'=>'update it']],
//sample for custom button
['button', '', ['class'=>'btn btn-box-tool', 'data-toggle'=>'tooltip', 'data-original-title'=>'some tooltip']]
],
]);
?>
<?php echo 'some content'; ?>
<?php BoxWidget::end();?>
To use gii with adminLTE template, add in config:, (*7)
'modules' => [
....
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['*'],
'generators' => [
'tcrud' => [
'class' => '\wokster\ltewidgets\generators\tcrud\Generator',
],
'tmodel' => [
'class' => '\wokster\ltewidgets\generators\tmodel\Generator',
]
]
],
....
],
this generator can create widgets for upload files and add behaviors and rules etc. in model and form. It's based on column names. So try name your column as:
text - gen imperavi redactor widget in form
status_id - gen status behavior in model and dropdown in form
url - gen autogenerate js from "title" attribute
img or image or media_url - gen behavior for upload in model and widget in form
date or date_start or date_finish - datePicker in form
sort - add rules for integer 1 - 99, (*8)