diff --git a/RbacAsset.php b/RbacAsset.php index 19f0278..45eaf53 100644 --- a/RbacAsset.php +++ b/RbacAsset.php @@ -33,22 +33,4 @@ class RbacAsset extends AssetBundle public $depends = [ 'yii\web\YiiAsset', ]; - - /** - * @var bool whether RbacAsset will be register only `rbac-route.js` without `js/rbac.js` - */ - public $registerOnlyRouteScript = false; - - /** - * @inheritdoc - */ - public function init() - { - if ($this->registerOnlyRouteScript) { - $this->js = [ - 'js/rbac-route.js', - ]; - } - parent::init(); - } } diff --git a/views/assignment/view.php b/views/assignment/view.php index 6a9a5b7..8c6eb68 100755 --- a/views/assignment/view.php +++ b/views/assignment/view.php @@ -2,6 +2,9 @@ use yii\helpers\Html; use yii\helpers\Json; +use yii2mod\rbac\RbacAsset; + +RbacAsset::register($this); /* @var $this yii\web\View */ /* @var $model \yii2mod\rbac\models\AssignmentModel */ @@ -25,4 +28,4 @@ 'removeUrl' => ['remove', 'id' => $model->userId], ]); ?> - \ No newline at end of file + diff --git a/views/item/_form.php b/views/item/_form.php index dc67499..08bd0f0 100644 --- a/views/item/_form.php +++ b/views/item/_form.php @@ -3,12 +3,9 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -/* - * @var $this yii\web\View - * @var $model yii2mod\rbac\models\AuthItemModel - */ +/* @var $this yii\web\View */ +/* @var $model yii2mod\rbac\models\AuthItemModel */ ?> -
@@ -34,4 +31,4 @@
- \ No newline at end of file + diff --git a/views/item/view.php b/views/item/view.php index 158d4a4..e44fe82 100644 --- a/views/item/view.php +++ b/views/item/view.php @@ -3,6 +3,9 @@ use yii\helpers\Html; use yii\helpers\Json; use yii\widgets\DetailView; +use yii2mod\rbac\RbacAsset; + +RbacAsset::register($this); /* @var $this yii\web\View */ /* @var $model \yii2mod\rbac\models\AuthItemModel */ @@ -44,4 +47,4 @@ 'assignUrl' => ['assign', 'id' => $model->name], 'removeUrl' => ['remove', 'id' => $model->name], ]); ?> - \ No newline at end of file + diff --git a/views/layouts/_sidebar.php b/views/layouts/_sidebar.php index 73027ff..19aafb9 100644 --- a/views/layouts/_sidebar.php +++ b/views/layouts/_sidebar.php @@ -1,12 +1,7 @@ set(RbacAsset::className(), ['registerOnlyRouteScript' => isset($registerOnlyRouteScript) ? true : false]); -RbacAsset::register($this); - $this->params['sidebar'] = [ [ 'label' => Yii::t('yii2mod.rbac', 'Assignments'), diff --git a/views/route/index.php b/views/route/index.php index 0616281..f49fc8f 100644 --- a/views/route/index.php +++ b/views/route/index.php @@ -2,17 +2,18 @@ use yii\helpers\Html; use yii\helpers\Json; +use yii2mod\rbac\RbacRouteAsset; + +RbacRouteAsset::register($this); /* @var $this yii\web\View */ -/* @var $routes [] */ +/* @var $routes array */ $this->title = Yii::t('yii2mod.rbac', 'Routes'); $this->params['breadcrumbs'][] = $this->title; -$this->render('/layouts/_sidebar', [ - 'registerOnlyRouteScript' => true, -]); +$this->render('/layouts/_sidebar'); ?> -

title); ?>

+

title); ?>

'btn btn-primary', 'id' => 'btn-refresh', @@ -23,4 +24,4 @@ ]), 'assignUrl' => ['assign'], 'removeUrl' => ['remove'], -]); ?> \ No newline at end of file +]); ?> diff --git a/views/rule/_form.php b/views/rule/_form.php index 9158620..98951f9 100755 --- a/views/rule/_form.php +++ b/views/rule/_form.php @@ -17,9 +17,13 @@ field($model, 'className')->textInput(); ?>
- getIsNewRecord() ? Yii::t('yii2mod.rbac', 'Create') : Yii::t('yii2mod.rbac', 'Update'), [ - 'class' => $model->getIsNewRecord() ? 'btn btn-success' : 'btn btn-primary', ]); ?> + getIsNewRecord() ? Yii::t('yii2mod.rbac', 'Create') : Yii::t('yii2mod.rbac', 'Update'), + [ + 'class' => $model->getIsNewRecord() ? 'btn btn-success' : 'btn btn-primary', + ] + ); ?>
- \ No newline at end of file + diff --git a/views/rule/view.php b/views/rule/view.php index c50245b..257d667 100644 --- a/views/rule/view.php +++ b/views/rule/view.php @@ -3,10 +3,8 @@ use yii\helpers\Html; use yii\widgets\DetailView; -/* - * @var yii\web\View $this - * @var \yii2mod\rbac\models\BizRuleModel $model - */ +/* @var $this yii\web\View */ +/* @var $model \yii2mod\rbac\models\BizRuleModel */ $this->title = Yii::t('yii2mod.rbac', 'Rule : {0}', $model->name); $this->params['breadcrumbs'][] = ['label' => Yii::t('yii2mod.rbac', 'Rules'), 'url' => ['index']]; @@ -34,4 +32,4 @@ ], ]); ?> - \ No newline at end of file +