Browse Source

Evolution #31: html: erreurs en couleurs

bastien 13 years ago
parent
commit
b460bb56b0

+ 8 - 4
app/Resources/translations/validators.fr.yml View File

2
 'The credentials were changed from another session.' :  "La page a été innactive trop longtemps, cuillez recharger la page."
2
 'The credentials were changed from another session.' :  "La page a été innactive trop longtemps, cuillez recharger la page."
3
 'The presented password cannot be empty.'            :  "Vous devez saisir un mot de passe."
3
 'The presented password cannot be empty.'            :  "Vous devez saisir un mot de passe."
4
 'The presented password is invalid.'                 :  "Le mot de passe est invalide."
4
 'The presented password is invalid.'                 :  "Le mot de passe est invalide."
5
+'Bad credentials'                                    :  "Vos identifiants sont incorrects."
5
 
6
 
6
 'The username is already used'   :   Le nom d'utilisateur est déjà utilisé.
7
 'The username is already used'   :   Le nom d'utilisateur est déjà utilisé.
7
-'The email is already used'      :   Cette adresse email est déjà utilisé sur Muzi.ch
8
+'The email is already used'      :   Cette adresse email est déjà utilisé.
9
+
8
 
10
 
9
 error:
11
 error:
10
   group:
12
   group:
11
     name:
13
     name:
12
-      unique:            Ce nom est déjà utilisé pour un autre groupe
14
+      unique:            Ce nom est déjà utilisé pour un autre groupe.
13
   registration:
15
   registration:
14
     username:
16
     username:
15
-      min:               Votre nom d'utilisateur doit contenir au moins %limit% caractères 
16
-      max:               Votre nom d'utilisateur doit contenir au maximum %limit% caractères 
17
+      min:               Votre nom d'utilisateur doit contenir au moins %limit% caractères.
18
+      max:               Votre nom d'utilisateur doit contenir au maximum %limit% caractères.
19
+    password:
20
+      notsame:           Vous avez saisie deux mot de passes différents.

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

214
         }
214
         }
215
         else
215
         else
216
         {
216
         {
217
-          $this->setFlash('error', 'element.add.error');
217
+          //$this->setFlash('error', 'element.add.error');
218
           
218
           
219
           $search_object = $this->getElementSearcher();
219
           $search_object = $this->getElementSearcher();
220
           $user = $this->getUser(true, array('join' => array(
220
           $user = $this->getUser(true, array('join' => array(

+ 17 - 3
src/Muzich/CoreBundle/Resources/views/Element/form.add.html.twig View File

1
+{% form_theme form 'MuzichCoreBundle:Form:errors.html.twig' %}
2
+
1
 {{ form_errors(form) }}
3
 {{ form_errors(form) }}
2
 
4
 
3
-{{ form_row(form.name) }}
5
+<div class="field">
6
+  {{ form_errors(form.name) }}
7
+  {{ form_label(form.name, 'name'|trans({}, 'elementform')) }}
8
+  {{ form_widget(form.name) }}
9
+</div>
4
 
10
 
5
-{{ form_row(form.url) }}
11
+<div class="field">
12
+  {{ form_errors(form.url) }}
13
+  {{ form_label(form.url, 'url'|trans({}, 'elementform')) }}
14
+  {{ form_widget(form.url) }}
15
+</div>
6
 
16
 
7
-{{ form_row(form.tags) }}
17
+<div class="field">
18
+  {{ form_errors(form.tags) }}
19
+  {{ form_label(form.tags, 'tags'|trans({}, 'elementform')) }}
20
+  {{ form_widget(form.tags) }}
21
+</div>
8
 
22
 
9
 {{ form_rest(form) }}
23
 {{ form_rest(form) }}

+ 11 - 0
src/Muzich/CoreBundle/Resources/views/Form/errors.html.twig View File

1
+{% block field_errors %}
2
+{% spaceless %}
3
+  {% if errors|length > 0 %}
4
+  <ul class="error_list">
5
+    {% for error in errors %}
6
+      <li>{{ error.messageTemplate|trans(error.messageParameters, 'validators') }}</li>
7
+    {% endfor %}
8
+  </ul>
9
+  {% endif %}
10
+{% endspaceless %}
11
+{% endblock field_errors %}

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

88
         'groups_owned'
88
         'groups_owned'
89
       )));
89
       )));
90
       
90
       
91
-      $this->setFlash('error', 'group.create.failure');
91
+      //$this->setFlash('error', 'group.create.failure');
92
       
92
       
93
       return $this->render(
93
       return $this->render(
94
         'MuzichGroupBundle:Default:myList.html.twig', 
94
         'MuzichGroupBundle:Default:myList.html.twig', 

+ 6 - 4
src/Muzich/GroupBundle/Resources/views/Form/form.html.twig View File

1
+{% form_theme form 'MuzichCoreBundle:Form:errors.html.twig' %}
2
+
1
 {{ form_errors(form) }}
3
 {{ form_errors(form) }}
2
 
4
 
3
 <div class="field">
5
 <div class="field">
4
-  {{ form_label(form.name, 'name'|trans({}, 'groupform')) }}
5
   {{ form_errors(form.name) }}
6
   {{ form_errors(form.name) }}
7
+  {{ form_label(form.name, 'name'|trans({}, 'groupform')) }}
6
   {{ form_widget(form.name) }}
8
   {{ form_widget(form.name) }}
7
 </div>
9
 </div>
8
 
10
 
9
 <div class="field">
11
 <div class="field">
10
-  {{ form_label(form.description, 'description'|trans({}, 'groupform')) }}
11
   {{ form_errors(form.description) }}
12
   {{ form_errors(form.description) }}
13
+  {{ form_label(form.description, 'description'|trans({}, 'groupform')) }}
12
   {{ form_widget(form.description) }}
14
   {{ form_widget(form.description) }}
13
 </div>
15
 </div>
14
 
16
 
15
   <i>{{ 'openhelp'|trans({}, 'groupform') }}</i>
17
   <i>{{ 'openhelp'|trans({}, 'groupform') }}</i>
16
 
18
 
17
 <div class="field">
19
 <div class="field">
18
-  {{ form_label(form.open, 'open'|trans({}, 'groupform')) }}
19
   {{ form_errors(form.open) }}
20
   {{ form_errors(form.open) }}
21
+  {{ form_label(form.open, 'open'|trans({}, 'groupform')) }}
20
   {{ form_widget(form.open) }}
22
   {{ form_widget(form.open) }}
21
 </div>
23
 </div>
22
 
24
 
23
 <div class="field">
25
 <div class="field">
24
-  {{ form_label(form.tags, 'tags'|trans({}, 'groupform')) }}
25
   {{ form_errors(form.tags) }}
26
   {{ form_errors(form.tags) }}
27
+  {{ form_label(form.tags, 'tags'|trans({}, 'groupform')) }}
26
   {{ form_widget(form.tags) }}
28
   {{ form_widget(form.tags) }}
27
 </div>
29
 </div>
28
 
30
 

+ 6 - 2
src/Muzich/MynetworkBundle/Resources/views/Mynetwork/search.html.twig View File

12
   
12
   
13
   <form action="{{ path('mynetwork_search') }}" method="post" {{ form_enctype(search_form) }}>
13
   <form action="{{ path('mynetwork_search') }}" method="post" {{ form_enctype(search_form) }}>
14
     
14
     
15
+    {% form_theme search_form 'MuzichCoreBundle:Form:errors.html.twig' %}
15
     {{ form_errors(search_form) }}
16
     {{ form_errors(search_form) }}
16
 
17
 
17
-    {{ form_row(search_form.string) }}
18
+    <div class="field">
19
+      {{ form_errors(search_form.string) }}
20
+      {{ form_widget(search_form.string) }}
21
+      <input type="submit" value="{{ 'search.form.submit_value'|trans({}, 'network') }}" />
22
+    </div>
18
 
23
 
19
     {{ form_rest(search_form) }}
24
     {{ form_rest(search_form) }}
20
 
25
 
21
-    <input type="submit" value="{{ 'search.form.submit_value'|trans({}, 'network') }}" />
22
   </form>
26
   </form>
23
   
27
   
24
   {% if results.users|length or results.groups|length %}
28
   {% if results.users|length or results.groups|length %}

+ 15 - 0
src/Muzich/UserBundle/Controller/UserController.php View File

41
    * Un bug étrange empêche la mise ne place de contraintes sur le formulaire
41
    * Un bug étrange empêche la mise ne place de contraintes sur le formulaire
42
    * d'inscription. On effectue alors les vérifications ici.
42
    * d'inscription. On effectue alors les vérifications ici.
43
    * 
43
    * 
44
+   * C'est sale, mais ça marche ...
45
+   * 
44
    * @return array of string errors
46
    * @return array of string errors
45
    */
47
    */
46
   protected function checkRegistrationInformations($form)
48
   protected function checkRegistrationInformations($form)
47
   {
49
   {
48
     $errors = array();
50
     $errors = array();
49
     $form->bindRequest($this->getRequest());
51
     $form->bindRequest($this->getRequest());
52
+    $form_values = $this->getRequest()->request->get($form->getName());
50
     $user = $form->getData();
53
     $user = $form->getData();
51
     
54
     
52
     /*
55
     /*
72
       );
75
       );
73
     }
76
     }
74
     
77
     
78
+    /**
79
+     * Mot de passes indentiques
80
+     */
81
+    if ($form_values['plainPassword']['first'] != $form_values['plainPassword']['second'])
82
+    {
83
+      $errors[] = $this->get('translator')->trans(
84
+        'error.registration.password.notsame', 
85
+        array(),
86
+        'validators'
87
+      );
88
+    }
89
+    
75
     return $errors;
90
     return $errors;
76
   }
91
   }
77
   
92
   

+ 6 - 8
src/Muzich/UserBundle/Resources/views/Registration/register.html.twig View File

4
     class="fos_user_registration_register"
4
     class="fos_user_registration_register"
5
   >
5
   >
6
         
6
         
7
+    {% form_theme form 'MuzichCoreBundle:Form:errors.html.twig' %}
7
     
8
     
8
-    {% if form.get("errors")|length > 0 %}
9
-    <ul class="error_list">
10
-      {% for error in form.get("errors") %}
11
-        <li>{{ error.messageTemplate|trans(error.messageParameters, 'validators') }}</li>
12
-      {% endfor %}
13
-    </ul>
14
-    {% endif %}
15
-    
9
+    {{ form_errors(form) }}
16
     {% if registration_errors_pers|length > 0 %}
10
     {% if registration_errors_pers|length > 0 %}
17
     <ul class="error_list">
11
     <ul class="error_list">
18
       {% for error in registration_errors_pers %}
12
       {% for error in registration_errors_pers %}
21
     </ul>
15
     </ul>
22
     {% endif %}
16
     {% endif %}
23
     
17
     
18
+    {{ form_errors(form.username) }}
24
     {{ form_row(form.username) }}
19
     {{ form_row(form.username) }}
25
     
20
     
21
+    {{ form_errors(form.email) }}
26
     {{ form_row(form.email) }}
22
     {{ form_row(form.email) }}
27
     
23
     
24
+    {{ form_errors(form.plainPassword.first) }}
28
     {{ form_row(form.plainPassword.first) }}
25
     {{ form_row(form.plainPassword.first) }}
29
     
26
     
27
+    {{ form_errors(form.plainPassword.second) }}
30
     {{ form_row(form.plainPassword.second) }}
28
     {{ form_row(form.plainPassword.second) }}
31
 
29
 
32
     {{ form_rest(form) }}
30
     {{ form_rest(form) }}

+ 1 - 1
src/Muzich/UserBundle/Resources/views/Security/login.html.twig View File

1
 <div class="login">
1
 <div class="login">
2
   {% if error %}
2
   {% if error %}
3
-      <div>{{ error|trans({}, 'validators') }}</div>
3
+      <ul class="error_list"><li>{{ error|trans({}, 'validators') }}</li></ul>
4
   {% endif %}
4
   {% endif %}
5
 
5
 
6
   <form action="{{ path("fos_user_security_check") }}" method="post">
6
   <form action="{{ path("fos_user_security_check") }}" method="post">

+ 16 - 0
web/bundles/muzichcore/css/main.css View File

273
 {
273
 {
274
   text-decoration: none;
274
   text-decoration: none;
275
   color: black;
275
   color: black;
276
+}
277
+
278
+.error_list
279
+{
280
+  font-size: 87%;
281
+  color: #dd0101;
282
+  
283
+  margin-left: 24px;
284
+  margin-top: 2px;
285
+  margin-bottom: 2px;
286
+  margin-right: 2px;
287
+}
288
+
289
+.error_list li
290
+{
291
+  list-style: url(/bundles/muzichcore/img/1323874685_warning.png);
276
 }
292
 }

BIN
web/bundles/muzichcore/img/1323874012_error_small.png View File


BIN
web/bundles/muzichcore/img/1323874038_error.png View File


BIN
web/bundles/muzichcore/img/1323874685_warning.png View File