Add 'partial' type to list columns.

This commit is contained in:
Sam Georges 2014-08-01 17:42:00 +10:00
parent e62f72e235
commit 8b7bbd1062
4 changed files with 26 additions and 7 deletions

View File

@ -53,12 +53,12 @@ class FormField
public $options;
/**
* @var string Specifies a side. Possible values: auto, left, right, full
* @var string Specifies a side. Possible values: auto, left, right, full.
*/
public $span = 'full';
/**
* @var string Specifies a size. Possible values: tiny, small, large, huge, giant
* @var string Specifies a size. Possible values: tiny, small, large, huge, giant.
*/
public $size = 'large';
@ -88,12 +88,12 @@ class FormField
public $comment;
/**
* @var string Specifies the comment position
* @var string Specifies the comment position.
*/
public $commentPosition = 'below';
/**
* @var string Specifies if the comment is in HTML format
* @var string Specifies if the comment is in HTML format.
*/
public $commentHtml = false;

View File

@ -56,10 +56,20 @@ class ListColumn
public $cssClass;
/**
* @var string Specify a format or style for the column value, such as a Date
* @var string Specify a format or style for the column value, such as a Date.
*/
public $format;
/**
* @var string Specifies a path for partial-type fields.
*/
public $path;
/**
* @var array Raw field configuration.
*/
public $config;
/**
* Constructor
*/
@ -96,6 +106,7 @@ class ListColumn
if (isset($config['select'])) $this->sqlSelect = $config['select'];
if (isset($config['relation'])) $this->relation = $config['relation'];
if (isset($config['format'])) $this->format = $config['format'];
if (isset($config['path'])) $this->path = $config['path'];
return $config;
}

View File

@ -598,6 +598,14 @@ class Lists extends WidgetBase
// Value processing
//
/**
* Process as boolean switch
*/
public function evalPartialTypeValue($value, $column)
{
return $this->controller->makePartial($column->path ?: $column->columnName, ['value' => $value, 'column' => $column]);
}
/**
* Process as boolean switch
*/

View File

@ -8,10 +8,10 @@ use Validator;
use System\Classes\SystemException;
use System\Classes\ApplicationException;
use October\Rain\Support\ValidationException;
use Exception;
use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use ArrayAccess;
use Exception;
/**
* This is a base class for all CMS objects - content files, pages, partials and layouts.