'}}}),zaa.directive("zaaCheckboxArray",function(){return{restrict:"E",scope:{model:"=",options:"=",i18n:"@i18n",id:"@fieldid",label:"@label",preselect:"@preselect"},controller:["$scope","$filter",function(n,i){null==n.model&&(n.model=[]),n.preselectOptionValuesToModel=function(e){angular.forEach(e,function(e){n.model.push({value:e.value})})},n.searchString="",n.$watch("options",function(e,t){null!=e&&e.hasOwnProperty("items")&&(n.optionitems=i("orderBy")(e.items,"label"),n.preselect&&n.preselectOptionValuesToModel(e.items))}),n.filtering=function(){n.optionitems=i("filter")(n.options.items,n.searchString)},n.toggleSelection=function(e){for(var t in null==n.model&&(n.model=[]),n.model)if(n.model[t].value==e.value)return void n.model.splice(t,1);n.model.push({value:e.value})},n.isChecked=function(e){for(var t in n.model)if(n.model[t].value==e.value)return!0;return!1}}],link:function(e){e.random=Math.random().toString(36).substring(7)},template:function(){return'
'}}}),zaa.directive("zaaTable",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@label",i18n:"@i18n",id:"@fieldid"},controller:["$scope",function(i){null==i.model&&(i.model=[{0:""}]),i.addColumn=function(){var e=0;for(var t in i.model[0])e++;for(var n in i.model)i.model[n][e]=""},i.addRow=function(){var e=i.model[0],t={};for(var n in e)t[n]="";i.model.push(t)},i.removeColumn=function(e){for(var t in i.model){var n=i.model[t];n instanceof Array?n.splice(e,1):delete n[e]}},i.moveLeft=function(e){for(var t in e=parseInt(e),i.model){var n=i.model[t][e];i.model[t][e]=i.model[t][e-1],i.model[t][e-1]=n}},i.moveRight=function(e){for(var t in e=parseInt(e),i.model){var n=i.model[t][e];i.model[t][e]=i.model[t][e+1],i.model[t][e+1]=n}},i.moveUp=function(e){e=parseInt(e);var t=i.model[e];i.model[e]=i.model[e-1],i.model[e-1]=t},i.moveDown=function(e){e=parseInt(e);var t=i.model[e];i.model[e]=i.model[e+1],i.model[e+1]=t},i.removeRow=function(e){i.model.splice(e,1)},i.showRightButton=function(e){return parseInt(e)
'}}}),zaa.directive("zaaCheckboxArray",function(){return{restrict:"E",scope:{model:"=",options:"=",i18n:"@i18n",id:"@fieldid",label:"@label",preselect:"@preselect"},controller:["$scope","$filter",function(n,i){null==n.model&&(n.model=[]),n.preselectOptionValuesToModel=function(e){angular.forEach(e,function(e){n.model.push({value:e.value})})},n.searchString="",n.$watch("options",function(e,t){null!=e&&e.hasOwnProperty("items")&&(n.optionitems=i("orderBy")(e.items,"label"),n.preselect&&n.preselectOptionValuesToModel(e.items))}),n.filtering=function(){n.optionitems=i("filter")(n.options.items,n.searchString)},n.toggleSelection=function(e){for(var t in null==n.model&&(n.model=[]),n.model)if(n.model[t].value==e.value)return void n.model.splice(t,1);n.model.push({value:e.value})},n.isChecked=function(e){for(var t in n.model)if(n.model[t].value==e.value)return!0;return!1}}],link:function(e){e.random=Math.random().toString(36).substring(7)},template:function(){return'
'}}}),zaa.directive("zaaTable",function(){return{restrict:"E",scope:{model:"=",options:"=",label:"@label",i18n:"@i18n",id:"@fieldid"},controller:["$scope",function(i){null==i.model&&(i.model=[{0:""}]),i.addColumn=function(){var e=0;for(var t in i.model[0])e++;for(var n in i.model)i.model[n][e]=""},i.addRow=function(){var e=i.model[0],t={};for(var n in e)t[n]="";i.model.push(t)},i.removeColumn=function(e){for(var t in i.model){var n=i.model[t];n instanceof Array?n.splice(e,1):delete n[e]}},i.moveLeft=function(e){for(var t in e=parseInt(e),i.model){var n=i.model[t][e];i.model[t][e]=i.model[t][e-1],i.model[t][e-1]=n}},i.moveRight=function(e){for(var t in e=parseInt(e),i.model){var n=i.model[t][e];i.model[t][e]=i.model[t][e+1],i.model[t][e+1]=n}},i.moveUp=function(e){e=parseInt(e);var t=i.model[e];i.model[e]=i.model[e-1],i.model[e-1]=t},i.moveDown=function(e){e=parseInt(e);var t=i.model[e];i.model[e]=i.model[e+1],i.model[e+1]=t},i.removeRow=function(e){i.model.splice(e,1)},i.showRightButton=function(e){return parseInt(e)
';
}
}
});
diff --git a/src/views/ngrest/crud.php b/src/views/ngrest/crud.php
index 70e709d091..8d5b781a87 100644
--- a/src/views/ngrest/crud.php
+++ b/src/views/ngrest/crud.php
@@ -2,6 +2,8 @@
use luya\admin\ngrest\render\RenderCrud;
use luya\admin\Module;
use luya\admin\helpers\Angular;
+use luya\helpers\ArrayHelper;
+use luya\helpers\Json;
/** @var $config \luya\admin\ngrest\ConfigInterface */
/** @var $this \luya\admin\ngrest\render\RenderCrudView */
@@ -10,6 +12,9 @@
/** @var $modelSelection string|boolean Whether a model can be selected from isInline call, if yes it contains the value from the previous selected model in order to highlight this id. If false the selection is disabled. */
$this->beginPage();
$this->beginBody();
+
+$filters = ArrayHelper::combine(array_keys($config->getFilters()));
+$filters = Angular::optionsArrayInput($filters);
?>
registerAngularControllerScript(); ?>
@@ -127,12 +132,7 @@
getFilters())): ?>
-
+
diff --git a/tests/admin/ngrest/base/ControllerTest.php b/tests/admin/ngrest/base/ControllerTest.php
new file mode 100644
index 0000000000..92883d2746
--- /dev/null
+++ b/tests/admin/ngrest/base/ControllerTest.php
@@ -0,0 +1,37 @@
+ User::class,
+ ]);
+
+ PermissionScope::run($this->app, function(PermissionScope $scope) {
+ $scope->loginUser();
+
+ $stub = new StubController('id', $this->app);
+ $html = $stub->actionIndex();
+
+ $this->assertNotEmpty($html);
+ });
+
+ }
+}
+
+class StubController extends Controller
+{
+ public $modelClass = User::class;
+}
\ No newline at end of file