Quellcode durchsuchen

Evolution #143: Commentaires sur un élément

bastien vor 12 Jahren
Ursprung
Commit
e5f72e2567

+ 4 - 1
src/Muzich/CommentBundle/Resources/views/Comment/comment.html.twig Datei anzeigen

@@ -1,6 +1,9 @@
1 1
 <a href="{{ path('show_user', {'slug': comment.u.s}) }}" >{{ comment.u.n }}</a>: 
2 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 8
 {% if app.user.id == comment.u.i %}
6 9
   <a title="{{ 'comment.edit.link'|trans({}, 'elements') }}" class="comment_edit_link" 

+ 6 - 0
src/Muzich/CoreBundle/Extension/MyTwigExtension.php Datei anzeigen

@@ -22,6 +22,12 @@ class MyTwigExtension extends \Twig_Extension {
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 31
   protected function datetime2timestamp($string)
26 32
   {
27 33
     list($date, $time) = explode(' ', $string);

+ 1 - 1
src/Muzich/CoreBundle/Managers/CommentsManager.php Datei anzeigen

@@ -62,7 +62,7 @@ class CommentsManager
62 62
             "s" => $user->getSlug(),
63 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 66
           "d" => $date,
67 67
           "c" => $comment_c
68 68
         );