added table-column ordering (#1086)

This commit is contained in:
Kevin Papst
2019-09-09 23:47:42 +02:00
committed by GitHub
parent d041a3f4f9
commit a651e55dc9
82 changed files with 932 additions and 516 deletions

View File

@@ -23,6 +23,7 @@ use App\Repository\ActivityRepository;
use App\Repository\CustomerRepository;
use App\Repository\ProjectRepository;
use App\Repository\Query\ActivityFormTypeQuery;
use App\Repository\Query\BaseQuery;
use App\Repository\Query\CustomerFormTypeQuery;
use App\Repository\Query\ProjectFormTypeQuery;
use App\Repository\Query\TimesheetQuery;
@@ -32,6 +33,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Validator\Constraints\Choice;
/**
* Defines the base form used for all toolbars.
@@ -51,9 +53,15 @@ abstract class AbstractToolbarForm extends AbstractType
return '';
}
/**
* Returns whether the Javascript select-picker is allowed.
* TODO can be removed... once all bugs are fixed.
*
* @return bool
*/
protected function getSelectpickerConfig(): bool
{
return false;
return true;
}
protected function addUserChoice(FormBuilderInterface $builder)
@@ -203,6 +211,24 @@ abstract class AbstractToolbarForm extends AbstractType
]);
}
protected function addHiddenOrder(FormBuilderInterface $builder)
{
$builder->add('order', HiddenType::class, [
'constraints' => [
new Choice(['choices' => [BaseQuery::ORDER_ASC, BaseQuery::ORDER_DESC]])
]
]);
}
protected function addHiddenOrderBy(FormBuilderInterface $builder, array $allowedColumns)
{
$builder->add('orderBy', HiddenType::class, [
'constraints' => [
new Choice(['choices' => $allowedColumns])
]
]);
}
protected function addTagInputField(FormBuilderInterface $builder)
{
$builder->add('tags', TagsInputType::class, [