Browse Source

Evolution #577: Affichages score: gestion espaces pour milliers, etc

Sevajol Bastien 12 years ago
parent
commit
245d87a7a0

+ 7 - 1
src/Muzich/CoreBundle/Extension/MyTwigExtension.php View File

@@ -21,7 +21,8 @@ class MyTwigExtension extends \Twig_Extension {
21 21
       'var_dump'               => new \Twig_Filter_Function('var_dump'),
22 22
       'date_or_relative_date'  => new \Twig_Filter_Method($this, 'date_or_relative_date'),
23 23
       'date_epurate'           => new \Twig_Filter_Method($this, 'date_epurate'),
24
-      'form_has_errors'        => new \Twig_Filter_Method($this, 'form_has_errors')
24
+      'form_has_errors'        => new \Twig_Filter_Method($this, 'form_has_errors'),
25
+      'format_score'           => new \Twig_Filter_Method($this, 'format_score')
25 26
     );
26 27
   }
27 28
   
@@ -33,6 +34,11 @@ class MyTwigExtension extends \Twig_Extension {
33 34
     );
34 35
   }
35 36
   
37
+  public function format_score($score)
38
+  {
39
+    return number_format($score, 0, '.', ' ');
40
+  }
41
+  
36 42
   protected function datetime2timestamp($string)
37 43
   {
38 44
     list($date, $time) = explode(' ', $string);

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

@@ -47,7 +47,7 @@
47 47
       
48 48
       <ul class="element_thumb_actions">
49 49
         <li class="score">
50
-          {{ element.points }}
50
+          {{ element.points|format_score }}
51 51
         </li>
52 52
           {% if element.owner.id != app.user.id %}
53 53
             <li class="vote thumb">

+ 1 - 1
src/Muzich/HomeBundle/Resources/views/Show/showUser.html.twig View File

@@ -45,7 +45,7 @@
45 45
       {% endif %}
46 46
       
47 47
       {{ 'user.reputation.name'|trans({}, 'users') }}: 
48
-      <span class="score">{{ viewed_user.reputation }}</span>
48
+      <span class="score">{{ viewed_user.reputation|format_score }}</span>
49 49
       {{ 'user.reputation.txt'|trans({}, 'users') }}
50 50
     </div>
51 51
     

+ 1 - 1
src/Muzich/UserBundle/Resources/views/Info/bar.html.twig View File

@@ -8,7 +8,7 @@
8 8
     {% endif %}
9 9
   </div>
10 10
   <div class="score blackgradiant">
11
-    {{ app.user.reputation }}
11
+    {{ app.user.reputation|format_score }}
12 12
   </div>
13 13
 </div>
14 14