use time helper for ago.js

This commit is contained in:
jomo
2014-10-12 22:28:12 +02:00
parent e9eef188d6
commit b574ea3e9e
9 changed files with 42 additions and 12 deletions

View File

@@ -18,9 +18,13 @@
<% if last_thread = f.threads.last %>
<% last_reply = Threadreply.where(forumthread: f.threads).order(:created_at).last %>
<% if last_reply && last_reply.created_at > last_thread.created_at %>
<%= last_reply.author.name %> <%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %> <time title="<%= last_reply.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= last_reply.created_at.to_datetime.rfc3339 %>"><%= last_reply.created_at.strftime("%e %b %Y, %H:%M") %></time>.
<%= last_reply.author.name %>
<%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %>
<%= time last_reply.created_at %>.
<% else %>
<%= last_thread.author.name %> <%= link_to "posted", forumthread_path(last_thread) %> <time title="<%= last_thread.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= last_thread.created_at.to_datetime.rfc3339 %>"><%= last_thread.created_at.strftime("%e %b %Y, %H:%M") %></time>.
<%= last_thread.author.name %>
<%= link_to "posted", forumthread_path(last_thread) %>
<%= time last_thread.created_at %>.
<% end %>
<% else %>
No posts yet.

View File

@@ -11,7 +11,10 @@
<div class="item-group with-avatar" id="thread-<%= thread.id %>">
<div class="header">
<%= link_to(thread.author.avatar(64), thread.author, title: thread.author.ign) %>
<%= render partial: "users/username", locals: { user: thread.author } %> <%= link_to thread do %><time title="<%= thread.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= thread.created_at.to_datetime.rfc3339 %>"><%= thread.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
<%= render partial: "users/username", locals: { user: thread.author } %>
<%= link_to thread do %>
<%= time thread.created_at %>
<% end %>
<span class="comment-counter">
<%= link_to pluralize(thread.replies.count, "Reply"), thread %>
</span>
@@ -22,7 +25,9 @@
<%= link_to truncate(thread.title, length: 60, omission: " …"), forumthread_path(thread), title: thread.title %>
<div class="item-info">
<% if rpl = thread.replies.last %>
<%= rpl.author.name %> <%= link_to "replied", forumthread_path(thread) + "#reply-#{rpl.id}" %> <time title="<%= rpl.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= rpl.created_at.to_datetime.rfc3339 %>"><%= rpl.created_at.strftime("%e %b %Y, %H:%M") %></time>.
<%= rpl.author.name %>
<%= link_to "replied", forumthread_path(thread) + "#reply-#{rpl.id}" %>
<%= time rpl.created_at %>.
<% else %>
No replies yet.
<% end %>