Browse Source

Evolution #143: Commentaires sur un élément

bastien 13 years ago
parent
commit
e5f72e2567

+ 4 - 1
src/Muzich/CommentBundle/Resources/views/Comment/comment.html.twig View File

1
 <a href="{{ path('show_user', {'slug': comment.u.s}) }}" >{{ comment.u.n }}</a>: 
1
 <a href="{{ path('show_user', {'slug': comment.u.s}) }}" >{{ comment.u.n }}</a>: 
2
 {{ comment.c }}
2
 {{ comment.c }}
3
-<span class="datesince">({{ comment.d|date_or_relative_date }})</span>
3
+<span class="datesince">
4
+  ({{ date_or_relative_date(comment.d, 'comment.created') }}{% if comment.e is defined %}
5
+   {{ date_or_relative_date(comment.e, 'comment.edited') }}{% endif %})
6
+</span>
4
 
7
 
5
 {% if app.user.id == comment.u.i %}
8
 {% if app.user.id == comment.u.i %}
6
   <a title="{{ 'comment.edit.link'|trans({}, 'elements') }}" class="comment_edit_link" 
9
   <a title="{{ 'comment.edit.link'|trans({}, 'elements') }}" class="comment_edit_link" 

+ 6 - 0
src/Muzich/CoreBundle/Extension/MyTwigExtension.php View File

22
     );
22
     );
23
   }
23
   }
24
   
24
   
25
+  public function getFunctions() {
26
+    return array(
27
+      'date_or_relative_date'  => new \Twig_Filter_Method($this, 'date_or_relative_date')
28
+    );
29
+  }
30
+  
25
   protected function datetime2timestamp($string)
31
   protected function datetime2timestamp($string)
26
   {
32
   {
27
     list($date, $time) = explode(' ', $string);
33
     list($date, $time) = explode(' ', $string);

+ 1 - 1
src/Muzich/CoreBundle/Managers/CommentsManager.php View File

62
             "s" => $user->getSlug(),
62
             "s" => $user->getSlug(),
63
             "n" => $user->getName()
63
             "n" => $user->getName()
64
           ),
64
           ),
65
-          "u" => date('Y-m-d H:i:s u'),
65
+          "e" => date('Y-m-d H:i:s u'),
66
           "d" => $date,
66
           "d" => $date,
67
           "c" => $comment_c
67
           "c" => $comment_c
68
         );
68
         );