mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3.6' into 3
This commit is contained in:
commit
283e3279be
10
docs/en/04_Changelogs/beta/3.6.0-beta2.md
Normal file
10
docs/en/04_Changelogs/beta/3.6.0-beta2.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# 3.6.0-beta2
|
||||||
|
|
||||||
|
<!--- Changes below this line will be automatically regenerated -->
|
||||||
|
|
||||||
|
## Change Log
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
|
||||||
|
* 2017-04-26 [000a5f7](https://github.com/silverstripe/silverstripe-cms/commit/000a5f7209065aceae14801244a08d3ed186e752) Fix page history / settings forms (Damian Mooyman)
|
||||||
|
* 2017-04-21 [7e77753](https://github.com/silverstripe/silverstripe-cms/commit/7e77753274421c79bac85c5b0c9a35728ce3e3aa) intl test (Daniel Hensby)
|
@ -102,6 +102,29 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
|
|||||||
return $dataListClone;
|
return $dataListClone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $class
|
||||||
|
* @param string $column
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function columnToFilterField($class, $column)
|
||||||
|
{
|
||||||
|
if (strpos($column, '.') === false) {
|
||||||
|
return $column;
|
||||||
|
}
|
||||||
|
/** @var DataObject $model */
|
||||||
|
$model = singleton($class);
|
||||||
|
$columnParts = explode('.', $column);
|
||||||
|
if ($model->getRelationClass($columnParts[0])) {
|
||||||
|
return $column;
|
||||||
|
}
|
||||||
|
return $columnParts[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param GridField $gridField
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getHTMLFragments($gridField) {
|
public function getHTMLFragments($gridField) {
|
||||||
if(!$this->checkDataType($gridField->getList())) return;
|
if(!$this->checkDataType($gridField->getList())) return;
|
||||||
|
|
||||||
@ -110,18 +133,21 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
|
|||||||
$columns = $gridField->getColumns();
|
$columns = $gridField->getColumns();
|
||||||
$filterArguments = $gridField->State->GridFieldFilterHeader->Columns->toArray();
|
$filterArguments = $gridField->State->GridFieldFilterHeader->Columns->toArray();
|
||||||
$currentColumn = 0;
|
$currentColumn = 0;
|
||||||
|
|
||||||
foreach($columns as $columnField) {
|
foreach($columns as $columnField) {
|
||||||
$currentColumn++;
|
++$currentColumn;
|
||||||
$metadata = $gridField->getColumnMetadata($columnField);
|
$metadata = $gridField->getColumnMetadata($columnField);
|
||||||
$title = $metadata['title'];
|
$title = $metadata['title'];
|
||||||
$fields = new FieldGroup();
|
$fields = new FieldGroup();
|
||||||
|
|
||||||
if($title && $gridField->getList()->canFilterBy($columnField)) {
|
$filterField = $this->columnToFilterField($gridField->getModelClass(), $columnField);
|
||||||
|
|
||||||
|
if($title && $gridField->getList()->canFilterBy($filterField)) {
|
||||||
$value = '';
|
$value = '';
|
||||||
if(isset($filterArguments[$columnField])) {
|
if(isset($filterArguments[$filterField])) {
|
||||||
$value = $filterArguments[$columnField];
|
$value = $filterArguments[$filterField];
|
||||||
}
|
}
|
||||||
$field = new TextField('filter[' . $gridField->getName() . '][' . $columnField . ']', '', $value);
|
$field = new TextField('filter[' . $gridField->getName() . '][' . $filterField . ']', '', $value);
|
||||||
$field->addExtraClass('ss-gridfield-sort');
|
$field->addExtraClass('ss-gridfield-sort');
|
||||||
$field->addExtraClass('no-change-track');
|
$field->addExtraClass('no-change-track');
|
||||||
|
|
||||||
@ -133,7 +159,7 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
|
|||||||
GridField_FormAction::create($gridField, 'reset', false, 'reset', null)
|
GridField_FormAction::create($gridField, 'reset', false, 'reset', null)
|
||||||
->addExtraClass('ss-gridfield-button-reset')
|
->addExtraClass('ss-gridfield-button-reset')
|
||||||
->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
|
->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
|
||||||
->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField)
|
->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $filterField)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +339,7 @@ class Image extends File implements Flushable {
|
|||||||
*
|
*
|
||||||
* @param integer $width The width to size to
|
* @param integer $width The width to size to
|
||||||
* @param integer $height The height to size to
|
* @param integer $height The height to size to
|
||||||
|
* @param string $backgroundColor The background colour to use on padded sides (default white)
|
||||||
* @param integer $transparencyPercent Level of transparency
|
* @param integer $transparencyPercent Level of transparency
|
||||||
* @return Image|null
|
* @return Image|null
|
||||||
*/
|
*/
|
||||||
@ -354,12 +355,16 @@ class Image extends File implements Flushable {
|
|||||||
* @param Image_Backend $backend
|
* @param Image_Backend $backend
|
||||||
* @param integer $width The width to size to
|
* @param integer $width The width to size to
|
||||||
* @param integer $height The height to size to
|
* @param integer $height The height to size to
|
||||||
|
* @param string $backgroundColor The background colour to use on padded sides (default white)
|
||||||
|
* @param integer $transparencyPercent Level of transparency
|
||||||
* @return Image_Backend
|
* @return Image_Backend
|
||||||
* @deprecated 4.0 Generate methods are no longer applicable
|
* @deprecated 4.0 Generate methods are no longer applicable
|
||||||
*/
|
*/
|
||||||
public function generatePad(Image_Backend $backend, $width, $height, $backgroundColor='FFFFFF') {
|
public function generatePad(Image_Backend $backend, $width, $height, $backgroundColor = 'FFFFFF',
|
||||||
|
$transparencyPercent = 0
|
||||||
|
) {
|
||||||
Deprecation::notice('4.0', 'Generate methods are no longer applicable');
|
Deprecation::notice('4.0', 'Generate methods are no longer applicable');
|
||||||
return $backend->paddedResize($width, $height, $backgroundColor);
|
return $backend->paddedResize($width, $height, $backgroundColor, $transparencyPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
32
tests/forms/gridfield/GridFieldFilterHeaderTest.php
Normal file
32
tests/forms/gridfield/GridFieldFilterHeaderTest.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class GridFieldFilterHeaderTest extends SapphireTest {
|
||||||
|
|
||||||
|
protected $extraDataObjects = array(
|
||||||
|
'GridFieldFilterHeaderTest_DataObject',
|
||||||
|
);
|
||||||
|
|
||||||
|
public function testColumnToFilterField() {
|
||||||
|
$class = 'GridFieldFilterHeaderTest_DataObject';
|
||||||
|
$header = new GridFieldFilterHeader();
|
||||||
|
$method = new ReflectionMethod($header, 'columnToFilterField');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
$this->assertEquals('Title', $method->invoke($header, $class,'Title.ATT'));
|
||||||
|
$this->assertEquals('isTest', $method->invoke($header, $class, 'isTest.Nice'));
|
||||||
|
$this->assertEquals('Self.isTest.Nice', $method->invoke($header, $class, 'Self.isTest.Nice'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class GridFieldFilterHeaderTest_DataObject extends DataObject implements TestOnly {
|
||||||
|
|
||||||
|
private static $db = array(
|
||||||
|
'Title' => 'Varchar',
|
||||||
|
'isTest' => 'Boolean',
|
||||||
|
);
|
||||||
|
|
||||||
|
private static $has_one = array(
|
||||||
|
'Self' => 'GridFieldFilterHeaderTest_DataObject',
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user