diff --git a/modules/backend/behaviors/ListController.php b/modules/backend/behaviors/ListController.php index 231693695..400cd6039 100644 --- a/modules/backend/behaviors/ListController.php +++ b/modules/backend/behaviors/ListController.php @@ -26,6 +26,11 @@ class ListController extends ControllerBehavior */ protected $primaryDefinition; + /** + * @var array List configuration, keys for alias and value for config objects. + */ + protected $listConfig = []; + /** * @var \Backend\Classes\WidgetBase Reference to the list widget object. */ @@ -102,7 +107,7 @@ class ListController extends ControllerBehavior $definition = $this->primaryDefinition; } - $listConfig = $this->makeConfig($this->listDefinitions[$definition], $this->requiredConfig); + $listConfig = $this->controller->listGetConfig($definition); /* * Create the model @@ -279,7 +284,7 @@ class ListController extends ControllerBehavior throw new ApplicationException(Lang::get('backend::lang.list.missing_parent_definition', compact('definition'))); } - $listConfig = $this->makeConfig($this->listDefinitions[$definition], $this->requiredConfig); + $listConfig = $this->controller->listGetConfig($definition); /* * Create the model @@ -331,19 +336,35 @@ class ListController extends ControllerBehavior $definition = $this->primaryDefinition; } - $collection = []; + $listConfig = $this->controller->listGetConfig($definition); + + $vars = [ + 'toolbar' => null, + 'filter' => null, + 'list' => null, + 'topPartial' => null, + 'sidePartial' => null + ]; + + if (isset($listConfig->topPartial)) { + $vars['topPartial'] = $listConfig->topPartial; + } + + if (isset($listConfig->sidePartial)) { + $vars['sidePartial'] = $listConfig->sidePartial; + } if (isset($this->toolbarWidgets[$definition])) { - $collection[] = $this->toolbarWidgets[$definition]->render(); + $vars['toolbar'] = $this->toolbarWidgets[$definition]; } if (isset($this->filterWidgets[$definition])) { - $collection[] = $this->filterWidgets[$definition]->render(); + $vars['filter'] = $this->filterWidgets[$definition]; } - $collection[] = $this->listWidgets[$definition]->render(); + $vars['list'] = $this->listWidgets[$definition]; - return implode(PHP_EOL, $collection); + return $this->makePartial('list', $vars); } /** @@ -377,6 +398,23 @@ class ListController extends ControllerBehavior return array_get($this->listWidgets, $definition); } + /** + * Returns the configuration used by this behavior. + * @return \Backend\Classes\WidgetBase + */ + public function listGetConfig($definition = null) + { + if (!$definition) { + $definition = $this->primaryDefinition; + } + + if (!$config = array_get($this->listConfig, $definition)) { + $config = $this->listConfig[$definition] = $this->makeConfig($this->listDefinitions[$definition], $this->requiredConfig); + } + + return $config; + } + // // Overrides // diff --git a/modules/backend/behaviors/importexportcontroller/assets/css/export.css b/modules/backend/behaviors/importexportcontroller/assets/css/export.css index 1278b0efe..b90013ca4 100644 --- a/modules/backend/behaviors/importexportcontroller/assets/css/export.css +++ b/modules/backend/behaviors/importexportcontroller/assets/css/export.css @@ -1,7 +1,7 @@ .export-behavior .export-columns { max-height: 400px; background: #f0f0f0; - padding: 15px; + padding: 20px; padding-bottom: 0; overflow: auto; } diff --git a/modules/backend/behaviors/importexportcontroller/assets/less/export.less b/modules/backend/behaviors/importexportcontroller/assets/less/export.less index 3ff782ed5..5f2e9f1c7 100644 --- a/modules/backend/behaviors/importexportcontroller/assets/less/export.less +++ b/modules/backend/behaviors/importexportcontroller/assets/less/export.less @@ -5,7 +5,7 @@ .export-columns { max-height: 400px; background: #f0f0f0; - padding: 15px; + padding: @padding-standard; padding-bottom: 0; overflow: auto; } diff --git a/modules/backend/behaviors/listcontroller/partials/_list.htm b/modules/backend/behaviors/listcontroller/partials/_list.htm new file mode 100644 index 000000000..0c910b69f --- /dev/null +++ b/modules/backend/behaviors/listcontroller/partials/_list.htm @@ -0,0 +1,24 @@ + + = $toolbar->render() ?> + + + + = $filter->render() ?> + + + + = $this->makePartial($topPartial) ?> + + + +
= $noRecordsMessage ?>