浏览代码

Merge branch 'develop' into features/background

François Drouhard 3 年之前
父节点
当前提交
5aaa9a3157

+ 13 - 0
assets/controllers/collapser-controller.js

@@ -0,0 +1,13 @@
+import { Controller } from "@stimulus/core";
+
+export default class extends Controller {
+    static targets = ['collapse', 'button']
+    connect() {
+        this.collapseTarget.addEventListener ('hide.bs.collapse', () => {
+            this.buttonTarget.innerHTML = '<i class="fa fa-chevron-circle-right fa-lg"></i>';
+        });
+        this.collapseTarget.addEventListener ('show.bs.collapse', () => {
+            this.buttonTarget.innerHTML = '<i class="fa fa-chevron-circle-down fa-lg"></i>';
+        })
+    }
+}

+ 3 - 0
assets/styles/app.scss

@@ -5,7 +5,10 @@ $yellow: #fde16d;
 @import "~bootstrap/scss/bootstrap";
 
 body {
+<<<<<<< HEAD
     background-image: url('../images/fond.jpg');
+=======
+>>>>>>> develop
     padding-top:5rem;
     padding-bottom:4rem;
 }

+ 23 - 0
src/Controller/SecurityController.php

@@ -2,6 +2,7 @@
 
 namespace App\Controller;
 
+use App\Entity\Profile;
 use App\Form\UserEditPasswordType;
 use App\Form\UserEditType;
 use App\Form\UserRegisterType;
@@ -14,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Routing\Annotation\Route;
 use App\Form\UserType;
 use App\Entity\User;
+use App\Form\ProfileType;
 use App\Repository\UserRepository;
 use Doctrine\ORM\EntityManagerInterface;
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@@ -82,6 +84,27 @@ class SecurityController extends AbstractController
         ));
     }
 
+    /**
+     * @Route("/admin/edituseroptions/{id}", name="admin_edituseroptions")
+     */
+    public function editUseroptions (Request $request, Profile $options, EntityManagerInterface $em)
+    {
+        $form = $this->createForm(ProfileType::class, $options);
+        $form->handleRequest($request);
+        if ($form->isSubmitted() && $form->isValid())
+        {
+            $em->flush();
+            $this->addFlash('success', 'Les options de l\'utilisateur ont bien été modifiées.');
+
+            return $this->redirectToRoute('admin_index');
+        }
+        
+        return $this->render('profil/preferences.html.twig', [
+            'user'  => $options->getUser(),
+            'form'  => $form->createView()
+        ]);
+    }
+
     /**
      * @Route("/admin", name="admin_index")
      */

+ 1 - 1
templates/footer.html.twig

@@ -1,5 +1,5 @@
 <div class="text-center fixed-bottom bg-white">
-    <span class="text-muted small">Cette application est développée en Symfony 5.3.10 - Code source disponible sur <a target="_blank" href="https://gogs.fdlibre.eu/sangfroid/films-symfony-4-2">Gogs</a><br>Licence <a target="_blank" href="http://www.wtfpl.net">WTFLP</a></span>
+    <span class="text-muted small">Code source disponible sur <a target="_blank" href="https://gogs.fdlibre.eu/sangfroid/films-symfony-4-2">Gogs</a> - Licence <a target="_blank" href="http://www.wtfpl.net">WTFLP</a></span>
 </div>
     
 {% block footer %}{% endblock %}

+ 10 - 0
templates/profil/form.preferences.html.twig

@@ -0,0 +1,10 @@
+{% form_theme form 'bootstrap_5_horizontal_layout.html.twig' %}
+{{ form_start(form) }}
+<div class="">
+    {{ form_row(form.view) }}
+</div>
+<div class="mb-3">
+    {{ form_widget(form.save) }}
+    <a href="{{ path('videotheque_liste') }}" class="btn btn-danger" role="button">Annuler</a>
+    {{ form_rest(form) }}
+</div>

+ 1 - 10
templates/profil/mespreferences.html.twig

@@ -4,14 +4,5 @@
 {% block titre %}Modifier mes préférences{%  endblock %}
 
 {% block body %}
-    {% form_theme form 'bootstrap_5_horizontal_layout.html.twig' %}
-    {{ form_start(form) }}
-    <div class="">
-        {{ form_row(form.view) }}
-    </div>
-    <div class="mb-3">
-        {{ form_widget(form.save) }}
-        <a href="{{ path('videotheque_liste') }}" class="btn btn-danger" role="button">Annuler</a>
-        {{ form_rest(form) }}
-    </div>
+    {{ include ('profil/form.preferences.html.twig') }}
 {% endblock %}

+ 8 - 0
templates/profil/preferences.html.twig

@@ -0,0 +1,8 @@
+{% extends "base.html.twig" %}
+
+{% block title %}{{ parent() }} - Préférences utilisateur{%  endblock %}
+{% block titre %}Modifier les options de {{ user.nomComplet }}{%  endblock %}
+
+{% block body %}
+    {{ include ('profil/form.preferences.html.twig') }}
+{% endblock %}

+ 3 - 2
templates/security/liste.html.twig

@@ -41,9 +41,10 @@
                 <td>{{ user.enabled }}</td>
                 <td>
                     {%  if user != app.user %}
-                        <a href="{{ path('admin_deluser', {'id': user.id})  }}"><i class="fa fa-trash fa-lg" style="color:Tomato;"></i></a>
+                        <a href="{{ path('admin_deluser', {'id': user.id})  }}"><i class="fa fa-trash fa-lg text-danger"></i></a>
                     {%  endif %}
-                    <a href="{{ path('admin_edituser', {'id': user.id})  }}"><i class="fa fa-edit fa-lg" style="color:DodgerBlue;"></i></a>
+                    <a href="{{ path('admin_edituser', {'id': user.id})  }}"><i class="fa fa-edit fa-lg text-primary"></i></a>
+                    <a href="{{ path('admin_edituseroptions', {'id': user.profile.id}) }}"><i class="fa fa-cog fa-lg"></i></a>
                 </td>
             </tr>
         {% endfor %}

+ 32 - 26
templates/videotheque/liste_vignettes.html.twig

@@ -35,7 +35,7 @@
 	<section id="tableFilms">
 		
 		{% for film in listeFilms %}
-		<article class="card border-primary mb-4" data-auteur="{{ film.authered.nomComplet }}">
+		<article class="card border-primary mb-4" data-controller="collapser" data-auteur="{{ film.authered.nomComplet }}">
 			<div class="card-header d-flex justify-content-between">
 				<h3 class="card-title"><a class="" href="{{ path('videotheque_voirfilm', {'id': film.id}) }}"><span data-bs-toggle="tooltip" data-placement="right" title="{{ film.information }}">{{ film.titre }}</span></a>
 					{% if film.new %}<span class="badge bg-success">New</span>{% endif %}
@@ -57,7 +57,7 @@
 								{{ vu_icone | raw }}
 							</button>
 						</div>
-						<div class="">
+						<div class="me-3">
 							{%  if app.user.wantToSee(film) %}
 								{% set follow_icone = "fa fa-bookmark fa-lg" %}
 								{% set follow_texte = "Supprimer ce film de votre liste à voir" %}
@@ -77,31 +77,12 @@
 							</button>
 						</div>
 					{% endif %}
-				</div>
-			</div>
-			<div class="card-body">
-				
-				<div class="d-flex">
-					<div class="me-3">
-						<input class="rating"
-							data-theme="krajee-fa"
-							data-language="fr"
-							data-display-only="true"
-							data-show-caption="false"
-							style="display:none;"
-							min=0
-							max=5
-							data-step=0.5
-							data-size="xs"
-							value="{{ film.note }}">
-					</div>
 					<div class="">
-						{% if film.nbComs %}
-							<a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}#coms"><span class="badge bg-warning text-dark">{{ film.nbComs }} commentaire{% if film.nbComs > 1 %}s{% endif %}</span></a>
-						{% endif %}
+						<button class="btn text-primary" data-collapser-target="button" data-bs-toggle="collapse" data-bs-target="#collapse-id-{{ film.id }}"><i class="fa fa-chevron-circle-right fa-lg"></i></button>
 					</div>
 				</div>
-
+			</div>
+			<div class="card-body collapse" id="collapse-id-{{ film.id }}" data-collapser-target="collapse">
 				<table class="table">
 					<tbody>
 						<tr>
@@ -124,11 +105,35 @@
 							{% endfor %}
 							</td>
 						</tr>
+						<tr>
+							<th>Informations</th>
+							<td>{% if film.information %}{{ film.information | nl2br }}{% else %}Pas d'information{% endif %}</td>
+						</tr>
 					</tbody>
 				</table>
-
 			</div>
-			<div class="card-footer text-end">
+			<div class="card-footer d-flex justify-content-between">
+				<div class="d-flex">
+					<div class="me-3">
+						<input class="rating"
+							data-theme="krajee-fa"
+							data-language="fr"
+							data-display-only="true"
+							data-show-caption="false"
+							style="display:none;"
+							min=0
+							max=5
+							data-step=0.5
+							data-size="xs"
+							value="{{ film.note }}">
+					</div>
+					<div class="">
+						{% if film.nbComs %}
+							<a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}#coms"><span class="badge bg-warning text-dark">{{ film.nbComs }} commentaire{% if film.nbComs > 1 %}s{% endif %}</span></a>
+						{% endif %}
+					</div>
+				</div>
+				<div class="">
 				{%  if film.authered is defined %}
 					Ajouté par 
 					{{ film.authered.username }}
@@ -138,6 +143,7 @@
 						<i class="fa fa-user-o text-secondary" data-bs-toggle="tooltip" title="Hors ligne"></i>
 					{% endif %}
 				{% endif %}
+				</div>
 			</div>
 		</article>
 		{% endfor %}