fix routes and translatable string in admin prototype

ref #12
ref #13
ref #14
ref #15
This commit is contained in:
2016-06-10 17:07:34 +02:00
parent 69af3e8d43
commit c8fcab4d1d
21 changed files with 105 additions and 69 deletions

View File

@@ -5,6 +5,7 @@ namespace Chill\EventBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
class EventTypeType extends AbstractType
{
@@ -15,7 +16,7 @@ class EventTypeType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('name', TranslatableStringFormType::class)
->add('active')
;
}

View File

@@ -5,9 +5,23 @@ namespace Chill\EventBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Chill\EventBundle\Entity\EventType;
class RoleType extends AbstractType
{
/**
*
* @var TranslatableStringHelper
*/
protected $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper) {
$this->translatableStringHelper = $translatableStringHelper;
}
/**
* @param FormBuilderInterface $builder
* @param array $options
@@ -15,9 +29,14 @@ class RoleType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('name', TranslatableStringFormType::class)
->add('active')
->add('type')
->add('type', EntityType::class, array(
'class' => EventType::class,
'choice_label' => function (EventType $e) {
return $this->translatableStringHelper->localize($e->getName());
}
))
;
}

View File

@@ -5,6 +5,8 @@ namespace Chill\EventBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Chill\EventBundle\Form\Type\PickEventType;
class StatusType extends AbstractType
{
@@ -15,9 +17,9 @@ class StatusType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('name', TranslatableStringFormType::class)
->add('active')
->add('type')
->add('type', PickEventType::class)
;
}