diff --git a/views/assignment/_script.js b/views/assignment/_script.js index 7db4674c..a9958b84 100644 --- a/views/assignment/_script.js +++ b/views/assignment/_script.js @@ -31,10 +31,13 @@ function search(target) { $list.html(''); var q = $('.search[data-target="' + target + '"]').val(); + var groups = { - role: [$(''), false], - permission: [$(''), false], + role: [$(''), false], + permission: [$(''), false], }; + + $.each(_opts.items[target], function (name, group) { if (name.indexOf(q) >= 0) { diff --git a/views/assignment/view.php b/views/assignment/view.php index 82e91c7c..43c3c786 100644 --- a/views/assignment/view.php +++ b/views/assignment/view.php @@ -26,7 +26,13 @@ $opts = Json::htmlEncode([ 'items' => $model->getItems(), ]); +$labels = Json::htmlEncode([ + 'Roles' => Yii::t('rbac-admin', 'Roles'), + 'Permissions' => Yii::t('rbac-admin', 'Permissions'), +]); + $this->registerJs("var _opts = {$opts};"); +$this->registerJs("var _labels = {$labels};"); $this->registerJs($this->render('_script.js')); $animateIcon = ' '; ?> diff --git a/views/item/_script.js b/views/item/_script.js index 6736f733..3c1537d1 100644 --- a/views/item/_script.js +++ b/views/item/_script.js @@ -33,10 +33,11 @@ function search(target) { var q = $('.search[data-target="' + target + '"]').val(); var groups = { - role: [$(''), false], - permission: [$(''), false], - route: [$(''), false], + role: [$(''), false], + permission: [$(''), false], + route: [$(''), false], }; + $.each(_opts.items[target], function (name, group) { if (name.indexOf(q) >= 0) { diff --git a/views/item/view.php b/views/item/view.php index a8b7b565..ea20dc2b 100644 --- a/views/item/view.php +++ b/views/item/view.php @@ -22,6 +22,14 @@ 'items' => $model->getItems(), ]); $this->registerJs("var _opts = {$opts};"); + +$labels = Json::htmlEncode([ + 'Roles' => Yii::t('rbac-admin', 'Roles'), + 'Permissions' => Yii::t('rbac-admin', 'Permissions'), + 'Routes' => Yii::t('rbac-admin', 'Routes'), +]); +$this->registerJs("var _labels = {$labels};"); + $this->registerJs($this->render('_script.js')); $animateIcon = ' '; ?>