Kaynağa Gözat

Ajout du formulaire tagFavorites sur la page my account.

bastien 13 yıl önce
ebeveyn
işleme
c7f7e1aacf

+ 1 - 1
src/Muzich/CoreBundle/Resources/views/Tag/tagFavoritesForm.html.twig Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-<form action="{{ path('update_tag_favorites') }}" method="post" {{ form_enctype(form) }}>
1
+<form action="{{ path('update_tag_favorites', { 'redirect' : redirect }) }}" method="post" {{ form_enctype(form) }}>
2 2
   {{ form_errors(form) }}
3 3
 
4 4
   {{ form_row(form.tags) }}

+ 11 - 2
src/Muzich/UserBundle/Controller/UserController.php Dosyayı Görüntüle

@@ -19,10 +19,19 @@ class UserController extends Controller
19 19
     $user = $this->getUser();
20 20
 
21 21
     $form_password = $this->container->get('fos_user.change_password.form');
22
+    
23
+    $form_tags_favorites = $this->createForm(
24
+      new TagFavoritesForm(), 
25
+      array('tags' => $this->getDoctrine()->getRepository('MuzichCoreBundle:User')
26
+        ->getTagIdsFavorites($user->getId())
27
+      ),
28
+      array('tags' => $this->getTagsArray())
29
+    );
22 30
 
23 31
       return array(
24 32
         'user' => $user,
25
-        'form_password' => $form_password->createView()
33
+        'form_password' => $form_password->createView(),
34
+        'form_tags_favorites' => $form_tags_favorites->createView()
26 35
       );
27 36
   }
28 37
   
@@ -156,7 +165,7 @@ class UserController extends Controller
156 165
     }
157 166
     else
158 167
     {
159
-      return $this->redirect($this->generateUrl('home'));
168
+      return $this->redirect($this->generateUrl('my_account'));
160 169
     }
161 170
   }
162 171
     

+ 7 - 0
src/Muzich/UserBundle/Resources/views/User/account.html.twig Dosyayı Görüntüle

@@ -15,6 +15,13 @@
15 15
     </li>
16 16
   </ul>
17 17
   
18
+  <h3>Vos tags préférés</h3>
19
+  
20
+  {% include "MuzichCoreBundle:Tag:tagFavoritesForm.html.twig" with { 
21
+    'form': form_tags_favorites,
22
+    'redirect' : 'account'
23
+  } %}
24
+  
18 25
   <h3>Changer mon mot de passe</h3>
19 26
   
20 27
   <form action="{{ path('change_password') }}" method="post" {{ form_enctype(form_password) }}>

+ 3 - 1
src/Muzich/UserBundle/Resources/views/User/start.html.twig Dosyayı Görüntüle

@@ -12,7 +12,9 @@
12 12
   
13 13
   <h3>Choisissez vos tags préférés</h3>
14 14
   
15
-  {% include "MuzichCoreBundle:Tag:tagFavoritesForm.html.twig" %}
15
+  {% include "MuzichCoreBundle:Tag:tagFavoritesForm.html.twig" with { 
16
+    'redirect' : 'home'
17
+  } %}
16 18
   
17 19
   <p>
18 20
     Vous pourrez egallement modifier vos tags préféré dans la partie 'mon compte'.