Added the missing lang strings, checked for the status before setting up default values, and updated the Date formats

This commit is contained in:
Nivanka Fonseka 2018-06-04 12:38:44 +05:30
parent 8bfab5c847
commit db7a79626d
2 changed files with 16 additions and 7 deletions

View File

@ -12,6 +12,7 @@ use SilverStripe\Forms\GridField\GridField_FormAction;
use SilverStripe\Forms\GridField\GridFieldFilterHeader; use SilverStripe\Forms\GridField\GridFieldFilterHeader;
use SilverStripe\Forms\TextField; use SilverStripe\Forms\TextField;
use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\FieldType\DBDate;
use SilverStripe\ORM\SS_List; use SilverStripe\ORM\SS_List;
use SilverStripe\View\ArrayData; use SilverStripe\View\ArrayData;
@ -91,22 +92,28 @@ class UserFormsGridFieldFilterHeader extends GridFieldFilterHeader
))); )));
foreach (array($start, $end) as $date) { foreach (array($start, $end) as $date) {
$date->setDateFormat('y-mm-dd'); $date->setDateFormat(DBDate::ISO_DATE);
$date->addExtraClass('no-change-track'); $date->addExtraClass('no-change-track');
} }
$end->setValue($state->end); if ($state->end) {
$start->setValue($state->start); $end->setValue($state->end);
}
if ($state->start) {
$start->setValue($state->start);
}
$fields->push($actions = FieldGroup::create( $fields->push($actions = FieldGroup::create(
GridField_FormAction::create($gridField, 'filter', false, 'filter', null) GridField_FormAction::create($gridField, 'filter', false, 'filter', null)
->addExtraClass('ss-gridfield-button-filter') ->addExtraClass('ss-gridfield-button-filter btn btn-primary')
->setAttribute('title', _t('SilverStripe\\Forms\\GridField\\GridField.Filter', "Filter")) ->setTitle(_t(__CLASS__.'.FILTER', "Filter"))
->setAttribute('title', _t(__CLASS__.'.FILTER', "Filter"))
->setAttribute('id', 'action_filter_' . $gridField->getModelClass() . '_' . $columnField), ->setAttribute('id', 'action_filter_' . $gridField->getModelClass() . '_' . $columnField),
GridField_FormAction::create($gridField, 'reset', false, 'reset', null) GridField_FormAction::create($gridField, 'reset', false, 'reset', null)
->addExtraClass('ss-gridfield-button-close') ->addExtraClass('ss-gridfield-button-close btn btn-primary')
->setAttribute('title', _t('SilverStripe\\Forms\\GridField\\GridField.ResetFilter', "Reset")) ->setTitle(_t(__CLASS__.'.RESET', "Reset"))
->setAttribute('title', _t(__CLASS__.'.RESET', "Reset"))
->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField) ->setAttribute('id', 'action_reset_' . $gridField->getModelClass() . '_' . $columnField)
)); ));

View File

@ -36,6 +36,8 @@ en:
FROM: From FROM: From
TILL: Till TILL: Till
WHEREVALUEIS: 'where value is..' WHEREVALUEIS: 'where value is..'
RESET: Reset
FILTER: Filter
SilverStripe\UserForms\Model\EditableCustomRule: SilverStripe\UserForms\Model\EditableCustomRule:
PLURALNAME: 'Editable Custom Rules' PLURALNAME: 'Editable Custom Rules'
PLURALS: PLURALS: