Browse Source

Messages d'erreurs françisé, amélioration dom ...

bastien 13 years ago
parent
commit
04ee0f2ed9

+ 5 - 0
app/Resources/translations/validators.en.yml View File

1
+
2
+error:
3
+  element:
4
+    name:
5
+      notblank:          Choose a name please

+ 9 - 0
app/Resources/translations/validators.fr.yml View File

24
   changeemail:
24
   changeemail:
25
     email:
25
     email:
26
       invalid:           L'email saisie n'est pas valide.
26
       invalid:           L'email saisie n'est pas valide.
27
+  element:
28
+    url:
29
+      notblank:          Vous devez saisir une url (adresse http://)
30
+      tolong:            L'url (adresse http://) est trop longue
31
+      invalid:           L'url (adresse http://) n'est pas correcte
32
+    name:
33
+      notblank:          Vous devez saisir un nom
34
+      toshort:           Le nom est trop court
35
+      tolong:            Le nom est trop long
27
       
36
       
28
 registration:
37
 registration:
29
   token:
38
   token:

+ 1 - 1
src/Muzich/CoreBundle/Controller/CoreController.php View File

248
 
248
 
249
         foreach ($errorList as $error)
249
         foreach ($errorList as $error)
250
         {
250
         {
251
-          $errors[] = $error->getMessage();
251
+          $errors[] = $this->trans($error->getMessage(), array(), 'validators');
252
         }
252
         }
253
         
253
         
254
         return $this->jsonResponse(array(
254
         return $this->jsonResponse(array(

+ 1 - 1
src/Muzich/CoreBundle/Controller/ElementController.php View File

139
       
139
       
140
       foreach ($errorList as $error)
140
       foreach ($errorList as $error)
141
       {
141
       {
142
-        $errors[] = $error->getMessage();
142
+        $errors[] = $this->trans($error->getMessage(), array(), 'validators');
143
       }
143
       }
144
     }
144
     }
145
     
145
     

+ 7 - 7
src/Muzich/CoreBundle/Entity/Element.php View File

77
    * L'url est l'url du media. 
77
    * L'url est l'url du media. 
78
    * 
78
    * 
79
    * @ORM\Column(type="string", length=1024)
79
    * @ORM\Column(type="string", length=1024)
80
-   * @Assert\NotBlank()
81
-   * @Assert\MaxLength(1024)
82
-   * @Assert\Url()
80
+   * @Assert\NotBlank(message = "error.element.url.notblank")
81
+   * @Assert\MaxLength(limit = 1024, message = "error.element.url.tolong")
82
+   * @Assert\Url(message = "error.element.url.invalid")
83
    * @var type string
83
    * @var type string
84
    */
84
    */
85
   protected $url;
85
   protected $url;
87
   /**
87
   /**
88
    * Libellé du media
88
    * Libellé du media
89
    * 
89
    * 
90
-   * @ORM\Column(type="string", length=128)
91
-   * @Assert\NotBlank()
92
-   * @Assert\MinLength(limit=3)
93
-   * @Assert\MaxLength(64)
90
+   * @ORM\Column(type = "string", length = 128)
91
+   * @Assert\NotBlank(message = "error.element.name.notblank")
92
+   * @Assert\MinLength(limit = 3, message = "error.element.name.toshort")
93
+   * @Assert\MaxLength(limit = 64, message = "error.element.name.tolong")
94
    * @var type string
94
    * @var type string
95
    */
95
    */
96
   protected $name;
96
   protected $name;

+ 2 - 0
src/Muzich/CoreBundle/Managers/GroupManager.php View File

51
     {
51
     {
52
       $this->em->remove($group_tag);
52
       $this->em->remove($group_tag);
53
     }
53
     }
54
+    $this->em->flush();
54
     // Pour etablir les nouveaux liens
55
     // Pour etablir les nouveaux liens
55
     $this->group->setTagsWithIds($this->em, $tags_ids);
56
     $this->group->setTagsWithIds($this->em, $tags_ids);
57
+    $this->em->flush();
56
   }
58
   }
57
   
59
   
58
 }
60
 }

+ 1 - 1
src/Muzich/CoreBundle/Resources/views/Element/ajax.element.edit.html.twig View File

1
 
1
 
2
-<form class="edit_element" name="{{ form_name }}" action="{{ path('element_update', {'element_id': element_id}) }}" method="post" {{ form_enctype(form) }}>
2
+<form novalidate class="edit_element" name="{{ form_name }}" action="{{ path('element_update', {'element_id': element_id}) }}" method="post" {{ form_enctype(form) }}>
3
 
3
 
4
   {% include "MuzichCoreBundle:Element:form.edit.html.twig" with { 
4
   {% include "MuzichCoreBundle:Element:form.edit.html.twig" with { 
5
     'form'          : form, 
5
     'form'          : form, 

+ 1 - 1
src/Muzich/CoreBundle/Resources/views/Element/element.edit.html.twig View File

6
 
6
 
7
   <span class="sinfo">{{ 'system.infos.normally_js'|trans({}, 'userui') }}</span>
7
   <span class="sinfo">{{ 'system.infos.normally_js'|trans({}, 'userui') }}</span>
8
 
8
 
9
-  <form name="{{ form_name }}" action="{{ path('element_update', {'element_id': element_id}) }}" method="post" {{ form_enctype(form) }}>
9
+  <form novalidate name="{{ form_name }}" action="{{ path('element_update', {'element_id': element_id}) }}" method="post" {{ form_enctype(form) }}>
10
 
10
 
11
     {% include "MuzichCoreBundle:Element:form.edit.html.twig" with { 
11
     {% include "MuzichCoreBundle:Element:form.edit.html.twig" with { 
12
       'form'          : form, 
12
       'form'          : form, 

+ 7 - 0
src/Muzich/CoreBundle/lib/Controller.php View File

295
     return $this->container->get('templating.helper.assets')->getUrl($path, $packageName);
295
     return $this->container->get('templating.helper.assets')->getUrl($path, $packageName);
296
   }
296
   }
297
   
297
   
298
+  /**
299
+   *
300
+   * @param strin $string
301
+   * @param array $params
302
+   * @param string $package
303
+   * @return string 
304
+   */
298
   protected function trans($string, $params = array(), $package = null)
305
   protected function trans($string, $params = array(), $package = null)
299
   {
306
   {
300
     return $this->get('translator')->trans($string, $params, $package);
307
     return $this->get('translator')->trans($string, $params, $package);

+ 23 - 16
src/Muzich/GroupBundle/Controller/DefaultController.php View File

36
     $form_new = $this->getGroupForm($new_group);
36
     $form_new = $this->getGroupForm($new_group);
37
     
37
     
38
     return array(
38
     return array(
39
-      'groups'        => $user->getGroupsOwned(),
40
-      'form_new'      => $form_new->createView(),
41
-      'form_new_name' => $form_new->getName()
39
+      'groups'         => $user->getGroupsOwned(),
40
+      'form_new'       => $form_new->createView(),
41
+      'form_new_name'  => $form_new->getName(),
42
+      'open_add_group' => false
42
     );
43
     );
43
   }
44
   }
44
   
45
   
94
       return $this->render(
95
       return $this->render(
95
         'MuzichGroupBundle:Default:myList.html.twig', 
96
         'MuzichGroupBundle:Default:myList.html.twig', 
96
          array(
97
          array(
97
-           'groups'        => $user->getGroupsOwned(),
98
-           'form_new'      => $form_new->createView(),
99
-           'form_new_name' => $form_new->getName()
98
+           'groups'         => $user->getGroupsOwned(),
99
+           'form_new'       => $form_new->createView(),
100
+           'form_new_name'  => $form_new->getName(),
101
+           'open_add_group' => true
100
          )
102
          )
101
       );
103
       );
102
     }
104
     }
138
       $prompt_tags[$tag->getTag()->getId()] = $tag->getTag()->getName();
140
       $prompt_tags[$tag->getTag()->getId()] = $tag->getTag()->getName();
139
     }
141
     }
140
     
142
     
141
-    $group->setTagsToIds();
143
+    $group->setTags($group->getTagsIdsJson());
142
     $form = $this->getGroupForm($group);
144
     $form = $this->getGroupForm($group);
143
     
145
     
144
     return array(
146
     return array(
159
       throw $this->createNotFoundException('Vous n\'ête pas le créateur de ce groupe.');
161
       throw $this->createNotFoundException('Vous n\'ête pas le créateur de ce groupe.');
160
     }
162
     }
161
 
163
 
162
-    // Pour être compatible avec le formulaire, la collection de tags dois être
163
-    // une collection d'id
164
-    $group->setTagsToIds();
164
+    $prompt_tags = array();
165
+    foreach ($group->getTags() as $tag)
166
+    {
167
+      $prompt_tags[$tag->getTag()->getId()] = $tag->getTag()->getName();
168
+    }
169
+    
170
+    // Pour être compatible avec le formulaire
171
+    $group->setTags($group->getTagsIdsJson());
165
     $form = $this->getGroupForm($group);
172
     $form = $this->getGroupForm($group);
166
     
173
     
167
     $form->bindRequest($request);
174
     $form->bindRequest($request);
178
       return $this->redirect($this->generateUrl('show_group', array('slug' => $group->getSlug())));
185
       return $this->redirect($this->generateUrl('show_group', array('slug' => $group->getSlug())));
179
     }
186
     }
180
     else
187
     else
181
-    {
182
-      $this->setFlash('error', 'group.update.failure');
183
-      
188
+    {      
184
       return $this->render(
189
       return $this->render(
185
-        'GroupBundle:Default:edit.html.twig', 
190
+        'MuzichGroupBundle:Default:edit.html.twig', 
186
          array(
191
          array(
187
-           'form_new'      => $form->createView(),
188
-           'form_new_name' => $form_new->getName()
192
+          'group'       => $group,
193
+          'form'        => $form->createView(),
194
+          'form_name'   => 'group',
195
+          'search_tags' => $prompt_tags
189
          )
196
          )
190
       );
197
       );
191
     }
198
     }

+ 1 - 1
src/Muzich/GroupBundle/Resources/views/Default/myList.html.twig View File

34
 
34
 
35
   {% endif %}
35
   {% endif %}
36
 
36
 
37
-  <div id="group_add_box" style="display: none;">
37
+  <div id="group_add_box" style="{% if not open_add_group %}display: none;{% endif %}">
38
 
38
 
39
     <a href="#" id="group_add_close_link" class="button">
39
     <a href="#" id="group_add_close_link" class="button">
40
       &lt;&lt; {{ 'group.add_group_box.close'|trans({}, 'navigationui') }}
40
       &lt;&lt; {{ 'group.add_group_box.close'|trans({}, 'navigationui') }}