Browse Source

liens vers les réalisateurs et films

François 6 years ago
parent
commit
a8581be5a9

+ 2 - 2
src/AppBundle/Controller/RealisateurController.php

@@ -60,7 +60,6 @@ class RealisateurController extends Controller
 		if ($form->isSubmitted() && $form->isValid())
 		{
             $em = $this->getDoctrine()->getManager();
-            $realisateur = $form->getData();
 			$em->flush();
 			$this->addFlash('success', 'Le réalisateur a été modifié');
 			return $this->redirectToRoute('realisateur_liste');
@@ -68,7 +67,8 @@ class RealisateurController extends Controller
 
 
 		return $this->render('@App/realisateur/modifier.html.twig', array(
-			'form'	=> $form->createView()
+			'form'	=> $form->createView(),
+            'realisateur'   =>  $realisateur
 		));
 	}
 

+ 1 - 1
src/AppBundle/Resources/public/assets/collectiontypeadd.js

@@ -16,7 +16,7 @@ function collectionsRealisateurs (reponse) {
 
     // On ajoute un premier champ automatiquement s'il n'en existe pas déjà un (cas d'une nouvelle annonce par exemple).
     if (index == 0) {
-        addRealisateur($container);
+        //addRealisateur($container);
     } else {
         // S'il existe déjà des catégories, on ajoute un lien de suppression pour chacune d'entre elles
         $container.children('fieldset').each(function() {

+ 1 - 1
src/AppBundle/Resources/views/realisateur/liste.html.twig

@@ -18,7 +18,7 @@
 			{% if realisateur.films is defined %}
 				<ul>
 				{% for film in realisateur.films %}
-					<li>{{  film.titre }}</li>
+					<li><a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}">{{  film.titre }}</a></li>
 				{% endfor %}
 				</ul>
 			{% endif %}

+ 16 - 4
src/AppBundle/Resources/views/realisateur/modifier.html.twig

@@ -4,9 +4,21 @@
 {% block titre %}Réalisateurs - Modifier{% endblock %}
 
 {% block body %}
-	{{  form_start(form) }}
-	{{ form_rest(form) }}
-	<button class="btn btn-primary" type="submit" formmethod="post">Enregistrer</button>
-	{{  form_end(form) }}
+	<div class="row">
+		<div class="col">
+			{{  form_start(form) }}
+			{{ form_rest(form) }}
+			<button class="btn btn-primary" type="submit" formmethod="post">Enregistrer</button>
+			{{  form_end(form) }}
+		</div>
+		<div class="col">
+			<h2>Liste des films de ce réalisateur</h2>
+			<ul>
+				{% for film in realisateur.films %}
+					<li><a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}">{{ film.titre }}</a></li>
+				{% endfor %}
+			</ul>
+		</div>
+	</div>
 
 {% endblock %}

+ 1 - 1
src/AppBundle/Resources/views/videotheque/liste.html.twig

@@ -52,7 +52,7 @@
 			{% if film.realisateurs is defined %}
 				<ul>
 				{%  for realisateur in film.realisateurs %}
-					<li>{{ realisateur.nomComplet }}</li>
+					<li><a href="{{ path('realisateur_modifier', {"id": realisateur.id}) }}">{{ realisateur.nomComplet }}</a></li>
 				{%  endfor %}
 				</ul>
 			{% endif %}

+ 1 - 1
src/AppBundle/Resources/views/videotheque/voirfilm.html.twig

@@ -28,7 +28,7 @@
                                 <p><strong>Réalisateur(s)</strong></p>
                                 <ul class="list-group">
                                 {% for realisateur in film.realisateurs %}
-                                    <li class="list-group-item">{{ realisateur.nomComplet }} <small><a href="{{ path('realisateur_modifier', {'id': realisateur.id}) }}">Modifier nom</a></small></li>
+                                    <li class="list-group-item"><a href="{{ path('realisateur_modifier', {'id': realisateur.id}) }}">{{ realisateur.nomComplet }}</a></li>
                                 {% endfor %}
                                 </ul>
                             </div>