From 21348793738e61633c970df15ae4740c38fc684d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20G=C4=85sior?= Date: Sat, 26 Feb 2022 01:49:59 +0100 Subject: [PATCH] Simplify radio table create screen - Remove frequency unit and description. Keep them in settings, although. - Redirect to newly created list instead of user lists index. Issue #116 --- assets/css/radio-table-create.css | 1 - src/Controller/RadioTableController.php | 2 +- src/Form/RadioTableCreateType.php | 12 ------------ src/Form/RadioTableSettingsType.php | 12 ++++++++++++ templates/radio_table/create.html.twig | 2 -- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/assets/css/radio-table-create.css b/assets/css/radio-table-create.css index 2a115aa2..380e4b40 100644 --- a/assets/css/radio-table-create.css +++ b/assets/css/radio-table-create.css @@ -1,2 +1 @@ @import './part/radio-table-status.css'; -@import './part/ckeditor.css'; diff --git a/src/Controller/RadioTableController.php b/src/Controller/RadioTableController.php index 0add499a..947b13b2 100644 --- a/src/Controller/RadioTableController.php +++ b/src/Controller/RadioTableController.php @@ -53,7 +53,7 @@ public function create(Request $request, EntityManagerInterface $entityManager): $entityManager->flush(); $this->addFlash('notice', 'radio_table.create.notification.created'); - return $this->redirectToRoute('user.my_radio_tables'); + return $this->redirectToRoute('radio_table.show', ['id' => $radioTable->getId()]); } return $this->render('radio_table/create.html.twig', [ diff --git a/src/Form/RadioTableCreateType.php b/src/Form/RadioTableCreateType.php index 3ef96183..2ac95111 100644 --- a/src/Form/RadioTableCreateType.php +++ b/src/Form/RadioTableCreateType.php @@ -3,7 +3,6 @@ namespace App\Form; use App\Entity\RadioTable; -use FOS\CKEditorBundle\Form\Type\CKEditorType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; @@ -19,17 +18,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->add('name', null, [ 'help' => 'radio_table.settings.form.name.help', ]) - ->add('frequencyUnit', ChoiceType::class, [ - 'choices' => [ - 'MHz' => RadioTable::FREQUENCY_MHZ, - 'kHz' => RadioTable::FREQUENCY_KHZ, - ], - 'choice_translation_domain' => false, - ]) - ->add('description', CKEditorType::class, [ - 'required' => false, - 'sanitize_html' => true, - ]) ->add('status', ChoiceType::class, [ 'expanded' => true, 'choices' => [ diff --git a/src/Form/RadioTableSettingsType.php b/src/Form/RadioTableSettingsType.php index a8a7d074..6847143d 100644 --- a/src/Form/RadioTableSettingsType.php +++ b/src/Form/RadioTableSettingsType.php @@ -6,6 +6,7 @@ use App\Entity\RadioTable; use App\Form\Type\IntegerUnitType; use App\Form\Type\RadioTableColumnsType; +use FOS\CKEditorBundle\Form\Type\CKEditorType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -19,6 +20,17 @@ public function buildForm(FormBuilderInterface $builder, array $options): void parent::buildForm($builder, $options); $builder + ->add('description', CKEditorType::class, [ + 'required' => false, + 'sanitize_html' => true, + ]) + ->add('frequencyUnit', ChoiceType::class, [ + 'choices' => [ + 'MHz' => RadioTable::FREQUENCY_MHZ, + 'kHz' => RadioTable::FREQUENCY_KHZ, + ], + 'choice_translation_domain' => false, + ]) ->add('maxSignalLevelUnit', ChoiceType::class, [ 'choices' => [ 'dB' => RadioTable::MAX_SIGNAL_LEVEL_DB, diff --git a/templates/radio_table/create.html.twig b/templates/radio_table/create.html.twig index 9f51f3ec..f757740e 100644 --- a/templates/radio_table/create.html.twig +++ b/templates/radio_table/create.html.twig @@ -19,8 +19,6 @@

{{ 'radio_table.settings.heading.general'|trans }}

{{ form_row(form.name) }} - {{ form_row(form.frequencyUnit) }} - {{ form_row(form.description) }}