Skip to content

Commit

Permalink
Simplify radio table create screen
Browse files Browse the repository at this point in the history
- Remove frequency unit and description. Keep them in settings, although.
- Redirect to newly created list instead of user lists index.

Issue #116
  • Loading branch information
TomaszGasior committed Apr 20, 2022
1 parent 79b62db commit 2134879
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
1 change: 0 additions & 1 deletion assets/css/radio-table-create.css
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import './part/radio-table-status.css';
@import './part/ckeditor.css';
2 changes: 1 addition & 1 deletion src/Controller/RadioTableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', [
Expand Down
12 changes: 0 additions & 12 deletions src/Form/RadioTableCreateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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' => [
Expand Down
12 changes: 12 additions & 0 deletions src/Form/RadioTableSettingsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions templates/radio_table/create.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<h2>{{ 'radio_table.settings.heading.general'|trans }}</h2>

{{ form_row(form.name) }}
{{ form_row(form.frequencyUnit) }}
{{ form_row(form.description) }}
</div>

<div>
Expand Down

0 comments on commit 2134879

Please sign in to comment.