Passed
Push — master ( 5e769b...b67b71 )
by Alexey
03:17
created

ICheckAsset::init()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace backend\assets\plugins;
4
5
use Yii;
6
use yii\web\AssetBundle;
7
use yii\web\JsExpression;
8
use yii\web\JqueryAsset;
9
use backend\assets\BootstrapAsset;
10
11
/**
12
 * Class ICheckAsset
13
 * @package backend\assets\plugins
14
 */
15
class ICheckAsset extends AssetBundle
16
{
17
    /**
18
     * @var string
19
     */
20
    public $sourcePath = '@vendor/almasaeed2010/adminlte/plugins';
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function init()
26
    {
27
        parent::init();
28
        $min = YII_ENV_DEV ? '' : '.min';
29
        $this->css = [
30
            'iCheck/all.css'
31
        ];
32
        $this->js = ['iCheck/icheck' . $min . '.js'];
33
        $view = Yii::$app->getView();
34
        $view->registerJs(new JsExpression("
35
            $(function () {
36
                $('input.iCheck').iCheck({
37
                    checkboxClass: 'icheckbox_square-blue',
38
                    radioClass: 'iradio_square-blue',
39
                    increaseArea: '20%' // optional
40
                });
41
            });
42
        "));
43
    }
44
45
    /**
46
     * @var array
47
     */
48
    public $depends = [
49
        JqueryAsset::class,
50
        BootstrapAsset::class
51
    ];
52
}
53