diff --git a/src/Controller/DebriefingAdminController.php b/src/Controller/DebriefingAdminController.php index 993f00d..703b56f 100644 --- a/src/Controller/DebriefingAdminController.php +++ b/src/Controller/DebriefingAdminController.php @@ -104,6 +104,7 @@ class DebriefingAdminController extends CrudController // ->setForm('filter', Type::class) ->setView('form', 'admin/debriefing/_form.html.twig') + ->setView('show_entity', 'admin/debriefing/_show.html.twig') // ->setMaxPerPage('index', 20) diff --git a/src/Entity/Debriefing.php b/src/Entity/Debriefing.php index d5cce00..c02ed6c 100644 --- a/src/Entity/Debriefing.php +++ b/src/Entity/Debriefing.php @@ -33,7 +33,7 @@ class Debriefing implements EntityInterface /** * @ORM\ManyToMany(targetEntity=Project::class, inversedBy="debriefings") */ - protected $project; + protected $projects; /** * @ORM\Column(type="text", nullable=true) @@ -92,15 +92,15 @@ class Debriefing implements EntityInterface /** * @return Collection */ - public function getProject(): Collection + public function getProjects(): Collection { - return $this->project; + return $this->projects; } public function addProject(Project $project): self { - if (!$this->project->contains($project)) { - $this->project[] = $project; + if (!$this->projects->contains($project)) { + $this->projects[] = $project; } return $this; @@ -108,7 +108,7 @@ class Debriefing implements EntityInterface public function removeProject(Project $project): self { - $this->project->removeElement($project); + $this->projects->removeElement($project); return $this; } diff --git a/src/Entity/Project.php b/src/Entity/Project.php index 8e12f5e..14a04c5 100644 --- a/src/Entity/Project.php +++ b/src/Entity/Project.php @@ -46,7 +46,7 @@ class Project implements EntityInterface protected $files = []; /** - * @ORM\ManyToMany(targetEntity=Debriefing::class, mappedBy="project") + * @ORM\ManyToMany(targetEntity=Debriefing::class, mappedBy="projects") */ protected $debriefings; diff --git a/src/Form/DebriefingType.php b/src/Form/DebriefingType.php index f42459c..e7dc700 100644 --- a/src/Form/DebriefingType.php +++ b/src/Form/DebriefingType.php @@ -19,7 +19,8 @@ class DebriefingType extends AbstractType 'html5' => true, 'widget' => 'single_text', ]) - ->add('project', null, [ + ->add('projects', null, [ + 'multiple' => true, 'attr' => [ 'data-jschoice' => '', ], diff --git a/templates/admin/debriefing/_form.html.twig b/templates/admin/debriefing/_form.html.twig index 64773de..0bddb01 100644 --- a/templates/admin/debriefing/_form.html.twig +++ b/templates/admin/debriefing/_form.html.twig @@ -1,6 +1,6 @@
- {% for item in ['date', 'project', 'internalContributors', 'externalContributors'] %} + {% for item in ['date', 'projects', 'internalContributors', 'externalContributors'] %} {% include(configuration.view('form_widget', '@Core/admin/crud/_form_widget.html.twig')) with {form: form[item]} %} {% endfor %}
diff --git a/templates/admin/debriefing/_show.html.twig b/templates/admin/debriefing/_show.html.twig new file mode 100644 index 0000000..86367fa --- /dev/null +++ b/templates/admin/debriefing/_show.html.twig @@ -0,0 +1,33 @@ +
+
+
    +
  • + Date + + {{ entity.date|date('d/m/Y') }} +
  • +
  • + Projets + + {% for item in entity.projects %} + {{ item.label }}
    + {% endfor %} +
  • +
  • + Contributeurs internes + + {{ entity.internalContributors|nl2br }} +
  • +
  • + Contributeurs externes + + {{ entity.externalContributors|nl2br }} +
  • +
+
+
+

{{ entity.topic }}

+ + {{ entity.content|raw }} +
+