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,15 +2,19 @@
2 2
 'The credentials were changed from another session.' :  "La page a été innactive trop longtemps, cuillez recharger la page."
3 3
 'The presented password cannot be empty.'            :  "Vous devez saisir un mot de passe."
4 4
 'The presented password is invalid.'                 :  "Le mot de passe est invalide."
5
+'Bad credentials'                                    :  "Vos identifiants sont incorrects."
5 6
 
6 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 11
 error:
10 12
   group:
11 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 15
   registration:
14 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,7 +214,7 @@ class CoreController extends Controller
214 214
         }
215 215
         else
216 216
         {
217
-          $this->setFlash('error', 'element.add.error');
217
+          //$this->setFlash('error', 'element.add.error');
218 218
           
219 219
           $search_object = $this->getElementSearcher();
220 220
           $user = $this->getUser(true, array('join' => array(

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

@@ -1,9 +1,23 @@
1
+{% form_theme form 'MuzichCoreBundle:Form:errors.html.twig' %}
2
+
1 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 23
 {{ form_rest(form) }}

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

@@ -0,0 +1,11 @@
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,7 +88,7 @@ class DefaultController extends Controller
88 88
         'groups_owned'
89 89
       )));
90 90
       
91
-      $this->setFlash('error', 'group.create.failure');
91
+      //$this->setFlash('error', 'group.create.failure');
92 92
       
93 93
       return $this->render(
94 94
         'MuzichGroupBundle:Default:myList.html.twig', 

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

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

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

@@ -12,13 +12,17 @@
12 12
   
13 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 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 24
     {{ form_rest(search_form) }}
20 25
 
21
-    <input type="submit" value="{{ 'search.form.submit_value'|trans({}, 'network') }}" />
22 26
   </form>
23 27
   
24 28
   {% if results.users|length or results.groups|length %}

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

@@ -41,12 +41,15 @@ class UserController extends Controller
41 41
    * Un bug étrange empêche la mise ne place de contraintes sur le formulaire
42 42
    * d'inscription. On effectue alors les vérifications ici.
43 43
    * 
44
+   * C'est sale, mais ça marche ...
45
+   * 
44 46
    * @return array of string errors
45 47
    */
46 48
   protected function checkRegistrationInformations($form)
47 49
   {
48 50
     $errors = array();
49 51
     $form->bindRequest($this->getRequest());
52
+    $form_values = $this->getRequest()->request->get($form->getName());
50 53
     $user = $form->getData();
51 54
     
52 55
     /*
@@ -72,6 +75,18 @@ class UserController extends Controller
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 90
     return $errors;
76 91
   }
77 92
   

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

@@ -4,15 +4,9 @@
4 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 10
     {% if registration_errors_pers|length > 0 %}
17 11
     <ul class="error_list">
18 12
       {% for error in registration_errors_pers %}
@@ -21,12 +15,16 @@
21 15
     </ul>
22 16
     {% endif %}
23 17
     
18
+    {{ form_errors(form.username) }}
24 19
     {{ form_row(form.username) }}
25 20
     
21
+    {{ form_errors(form.email) }}
26 22
     {{ form_row(form.email) }}
27 23
     
24
+    {{ form_errors(form.plainPassword.first) }}
28 25
     {{ form_row(form.plainPassword.first) }}
29 26
     
27
+    {{ form_errors(form.plainPassword.second) }}
30 28
     {{ form_row(form.plainPassword.second) }}
31 29
 
32 30
     {{ form_rest(form) }}

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

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

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

@@ -273,4 +273,20 @@ ul.inline li
273 273
 {
274 274
   text-decoration: none;
275 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