Skip to content

Commit

Permalink
Transform the 'time_elapsed' function into the 'elapsed' filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
nrk committed Nov 6, 2011
1 parent d37f164 commit 25ba0a3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Lamest/Twig/LamestExtension.php
Expand Up @@ -43,6 +43,7 @@ public function getFilters()
return array(
'to_int' => new Twig_Filter_Function('intval'),

'elapsed' => new Twig_Filter_Function(__CLASS__.'::timeElapsed'),
'commentize' => new Twig_Filter_Function(__CLASS__.'::renderCommentText', array(
'needs_environment' => true,
'is_safe' => array('html'),
Expand All @@ -58,7 +59,6 @@ public function getFunctions()
return array(
'now' => new Twig_Function_Function('time'),

'time_elapsed' => new Twig_Function_Function(__CLASS__.'::timeElapsed'),
'gravatar' => new Twig_Function_Function(__CLASS__.'::getGravatarLink'),
'news_editable' => new Twig_Function_Function(__CLASS__.'::isNewsEditable'),
'comment_score' => new Twig_Function_Function(__CLASS__.'::commentScore'),
Expand Down
2 changes: 1 addition & 1 deletion template/news.html.twig
Expand Up @@ -13,7 +13,7 @@
<span class="avatar"><img src="{{ gravatar(user.email) }}"></span>
<span class="info">
<span class="username"><a href="/user/{{ news.username }}">{{ news.username }}</a></span>
{{ time_elapsed(news.ctime) }}.
{{ news.ctime | elapsed }}.
</span>
<pre>{{ news_text(news) | commentize }}</pre>
</article>
Expand Down
4 changes: 2 additions & 2 deletions template/shared.html.twig
Expand Up @@ -19,7 +19,7 @@
<p>
{{ news.up }} up and {{ news.down }} down,
posted by <span class="username"><a href="/user/{{ news.username }}">{{ news.username }}</a></span>
{{ time_elapsed(news.ctime) }} <a href="/news/{{ news.id }}">{{ news.comments }} comments</a>
{{ news.ctime | elapsed }} <a href="/news/{{ news.id }}">{{ news.comments }} comments</a>
</p>
</article>
{% else %}
Expand Down Expand Up @@ -60,7 +60,7 @@
<span class="avatar"><img src="{{ gravatar(user.email) }}"></span>
<span class="info">
<span class="username"><a href="/user/{{ user.username }}">{{ user.username }}</a></span>
{{ time_elapsed(comment.ctime) }}.
{{ comment.ctime | elapsed }}.
<a href="/comment/{{ news_id }}/{{ comment.id }}" class="reply">link</a>
{% if app.user and comment.topcomment is not defined %}
<a href="/reply/{{ news_id }}/{{ comment.id }}" class="reply">reply</a>
Expand Down
2 changes: 1 addition & 1 deletion template/userprofile.html.twig
Expand Up @@ -8,7 +8,7 @@
<h2>{{ user.username }}</h2>
<pre>{{ user.about }}</pre>
<ul>
<li><b>created </b> {{ time_elapsed(user.ctime) }}</li>
<li><b>created </b> {{ user.ctime | elapsed }}</li>
<li><b>karma </b>{{ user.karma }} points</li>
<li><b>posted news </b>{{ user_counters.posted_news }}</li>
<li><b>posted comments </b>{{ user_counters.posted_comments }}</li>
Expand Down

0 comments on commit 25ba0a3

Please sign in to comment.