Pārlūkot izejas kodu

Ajout du formulaire tagFavorites sur la page my account.

bastien 13 gadus atpakaļ
vecāks
revīzija
c7f7e1aacf

+ 1 - 1
src/Muzich/CoreBundle/Resources/views/Tag/tagFavoritesForm.html.twig Parādīt failu

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
   {{ form_errors(form) }}
2
   {{ form_errors(form) }}
3
 
3
 
4
   {{ form_row(form.tags) }}
4
   {{ form_row(form.tags) }}

+ 11 - 2
src/Muzich/UserBundle/Controller/UserController.php Parādīt failu

19
     $user = $this->getUser();
19
     $user = $this->getUser();
20
 
20
 
21
     $form_password = $this->container->get('fos_user.change_password.form');
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
       return array(
31
       return array(
24
         'user' => $user,
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
     }
165
     }
157
     else
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 Parādīt failu

15
     </li>
15
     </li>
16
   </ul>
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
   <h3>Changer mon mot de passe</h3>
25
   <h3>Changer mon mot de passe</h3>
19
   
26
   
20
   <form action="{{ path('change_password') }}" method="post" {{ form_enctype(form_password) }}>
27
   <form action="{{ path('change_password') }}" method="post" {{ form_enctype(form_password) }}>

+ 3 - 1
src/Muzich/UserBundle/Resources/views/User/start.html.twig Parādīt failu

12
   
12
   
13
   <h3>Choisissez vos tags préférés</h3>
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
   <p>
19
   <p>
18
     Vous pourrez egallement modifier vos tags préféré dans la partie 'mon compte'.
20
     Vous pourrez egallement modifier vos tags préféré dans la partie 'mon compte'.