Split NPC page: read-only detail + game notes, separate full edit form

- /npcs/{id} (app_npc_show): portrait, all fields shown read-only, and
  the only editable control is the game-notes textarea. Father/Mother
  link through to their own pages.
- /npcs/{id}/edit (app_npc_edit): the full structured form, now WITHOUT
  game notes; saving returns to the detail page.
- NpcType drops gameNotes; new NpcGameNotesType holds just that field.
- The DataTable row link (/npcs/{id}) now lands on the detail page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-09-06 16:17:03 +02:00
co-authored by Claude Sonnet 5
parent 71b5cb6633
commit d43746970b
5 changed files with 148 additions and 44 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Form;
use App\Entity\Npc;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* The only editable thing on the NPC detail page: the DM's live play notes.
*/
class NpcGameNotesType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('gameNotes', TextareaType::class, [
'required' => false,
'label' => false,
'attr' => ['rows' => 14, 'placeholder' => 'What happened with this NPC during play…'],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(['data_class' => Npc::class]);
}
}
+2 -6
View File
@@ -51,12 +51,8 @@ class NpcType extends AbstractType
->add('mother', EntityType::class, $parent)
->add('villageStatus', EnumType::class, $enum(VillageStatus::class))
->add('bloodCartInvolvement', EnumType::class, $enum(BloodCartInvolvement::class))
->add('mysteryImportance', EnumType::class, $enum(MysteryImportance::class))
->add('gameNotes', TextareaType::class, [
'required' => false,
'label' => 'Game notes',
'attr' => ['rows' => 10, 'placeholder' => 'What happened with this NPC during play…'],
]);
->add('mysteryImportance', EnumType::class, $enum(MysteryImportance::class));
// gameNotes lives on the detail page, not this form.
}
public function configureOptions(OptionsResolver $resolver): void