Browse Source

genres dans la liste

François 6 years ago
parent
commit
c8d3285f87

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

@@ -5,7 +5,6 @@ function requete(chemin, nomDuDiv, nomDuBouton) {
         dataType: 'json',
         success: function (reponse) {
             var reponseArray = parseJson(reponse);
-            console.log(reponseArray)
             collections(reponseArray, nomDuDiv, nomDuBouton);
         }
     })
@@ -17,7 +16,6 @@ function parseJson(data) {
         let UnObjetJson = data[i];
         let obj = JSON.parse(UnObjetJson);
         sortie = Object.values(obj)
-        console.log(sortie[0]);
         tableau.push(sortie[0]);
     }
     return tableau;
@@ -58,7 +56,7 @@ function collections (reponse, nomDuDiv, nomDuBouton) {
         // - le texte "__name__label__" qu'il contient par le label du champ
         // - le texte "__name__" qu'il contient par le numéro du champ
         var template = $container.attr('data-prototype')
-            .replace(/__name__label__/g, 'Truc')
+            .replace(/__name__label__/g, '')
             .replace(/__name__/g,        index)
         ;
 

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

@@ -18,6 +18,7 @@
 			<th>Vu</th>
 			<th>Ajouté par</th>
 			<th>Titre du film</th>
+			<th>Genre</th>
 			<th>Réalisateur</th>
 			<th>Année</th>
 			<th>Actions</th>
@@ -57,6 +58,13 @@
 				{% endif %}
 			</td>
 			<td><a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}">{{ film.titre }}</a></td>
+			<td>
+				{% if film.genres is defined %}
+					{% for genre in film.genres %}
+						<span class="badge badge-secondary">{{ genre.name }}</span>
+					{% endfor %}
+				{% endif %}
+			</td>
 			<td>
 			{% if film.realisateurs is defined %}
 				<ul>