Fixed drop-down widget properties on the dashboard

This commit is contained in:
alekseybobkov 2014-08-02 12:29:17 +11:00
parent d562e68b91
commit fecfeee2ac
4 changed files with 11 additions and 5 deletions

View File

@ -3,6 +3,7 @@
use BackendMenu;
use Backend\Classes\Controller;
use Backend\Widgets\ReportContainer;
use Backend\Traits\InspectableContainer;
/**
* Dashboard controller
@ -13,6 +14,7 @@ use Backend\Widgets\ReportContainer;
*/
class Index extends Controller
{
use InspectableContainer;
public $requiredPermissions = ['backend.access_dashboard'];

View File

@ -40,7 +40,7 @@ trait InspectableContainer
if (!$traitFound)
throw new ApplicationException('The options cannot be loaded for the specified class.');
$obj = new $className();
$obj = new $className(null);
$methodName = 'get'.ucfirst($property).'Options';
if (method_exists($obj, $methodName))

View File

@ -311,15 +311,18 @@ class ReportContainer extends WidgetBase
$result[] = $property;
foreach ($properties as $name=>$params) {
$property = [
'property' => $name,
'title' => isset($params['title']) ? $params['title'] : $name,
'description' => isset($params['description']) ? $params['description'] : null,
'type' => isset($params['type']) ? $params['type'] : 'string',
'validationPattern' => isset($params['validationPattern']) ? $params['validationPattern'] : null,
'validationMessage' => isset($params['validationMessage']) ? $params['validationMessage'] : null
'type' => isset($params['type']) ? $params['type'] : 'string'
];
foreach ($params as $name => $value) {
if (isset($property[$name])) continue;
$property[$name] = $value;
}
$result[] = $property;
}

View File

@ -14,6 +14,7 @@
data-inspector-title="Widget configuration"
data-inspector-description="Configure the report widget"
data-inspector-config="<?= e($this->getWidgetPropertyConfig($widget)) ?>"
data-inspector-class="<?= get_class($widget) ?>"
data-inspector-offset="-3"
data-inspector-offset-x="-15"
data-inspector-placement="left"