use time helper for ago.js
This commit is contained in:
@@ -10,6 +10,14 @@ module ApplicationHelper
|
||||
site_headers
|
||||
end
|
||||
|
||||
def time(tm)
|
||||
if tm
|
||||
content_tag :time, title: tm.strftime("%e %b %Y, %H:%M"), datetime: tm.to_datetime.rfc3339 do
|
||||
tm.strftime("%e %b %Y, %H:%M")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def render_md(content)
|
||||
renderer = Redcarpet::Render::HTML.new({
|
||||
filter_html: true,
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
<div class="item-group with-avatar" id="post-<%= p.id %>">
|
||||
<div class="header">
|
||||
<%= link_to(p.author.avatar(64), p.author, title: p.author.ign) %>
|
||||
<%= render partial: "users/username", locals: { user: p.author } %> <%= link_to p do %><time title="<%= p.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= p.created_at.to_datetime.rfc3339 %>"><%= p.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
|
||||
<%= render partial: "users/username", locals: { user: p.author } %>
|
||||
<%= link_to p do %>
|
||||
<%= time p.created_at %>
|
||||
<% end %>
|
||||
<span class="comment-counter">
|
||||
<%= link_to pluralize(p.comments.count, "Comment"), p %>
|
||||
</span>
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
<div class="item-group post with-avatar" id="post-<%= @post.id %>">
|
||||
<div class="header">
|
||||
<%= link_to(@post.author.avatar(64), @post.author, title: @post.author.ign) %>
|
||||
<%= render partial: "users/username", locals: { user: @post.author } %> <%= link_to p do %><time title="<%= @post.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= @post.created_at.to_datetime.rfc3339 %>"><%= @post.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
|
||||
<%= render partial: "users/username", locals: { user: @post.author } %>
|
||||
<%= link_to p do %>
|
||||
<%= time @post.created_at %>
|
||||
<% end %>
|
||||
<%= link_to "edit", edit_blogpost_path(@post.id), class: "editlink" if mod? %>
|
||||
<div class="clear-right"></div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<div class="header <%= "op" if c.author.is?(c.blogpost.author) %>">
|
||||
<%= link_to(c.author.avatar(64), c.author, title: c.author.ign) %>
|
||||
<%= render partial: "users/username", locals: { user: c.author } %>
|
||||
<%= link_to "#comment-#{c.id}" do %><time title="<%= c.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= c.created_at.to_datetime.rfc3339 %>"><%= c.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
|
||||
<%= link_to "#comment-#{c.id}" do %>
|
||||
<%= time c.created_at %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "edit", edit_blogpost_comment_path(c.blogpost, c), class: "editlink" if (mod? || c.author.is?(current_user)) %>
|
||||
<div class="clear-right"></div>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
<div class="item-group thread 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 p 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 p do %>
|
||||
<%= time @thread.created_at %>
|
||||
<% end %>
|
||||
<%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if (@thread.author.is?(current_user) || mod?) %>
|
||||
<div class="clear-right"></div>
|
||||
</div>
|
||||
<div class="items">
|
||||
<% if @thread.edited? %>
|
||||
<div class="item edited">
|
||||
Last edited <time title="<%= @thread.updated_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= @thread.updated_at.to_datetime.rfc3339 %>"><%= @thread.updated_at.strftime("%e %b %Y, %H:%M") %></time> by <%= link_to @thread.editor.name, @thread.editor %>.
|
||||
Last edited <%= time @thread.updated_at %> by <%= link_to @thread.editor.name, @thread.editor %>.
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="item content">
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
<div class="header">
|
||||
<%= link_to(reply.author.avatar(64), reply.author, title: reply.author.ign) %>
|
||||
<%= render partial: "users/username", locals: { user: reply.author } %>
|
||||
<%= link_to "#reply-#{reply.id}" do %><time title="<%= reply.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= reply.created_at.to_datetime.rfc3339 %>"><%= reply.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
|
||||
<%= link_to "#reply-#{reply.id}" do %>
|
||||
<%= time reply.created_at %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || reply.author.is?(current_user) %>
|
||||
<div class="clear-right"></div>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<% end %>
|
||||
<tr>
|
||||
<td><b>Joined</b></td>
|
||||
<td><time title="<%= @user.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= @user.created_at.to_datetime.rfc3339 %>"><%= @user.created_at.strftime("%e %b %Y, %H:%M") %></time></td>
|
||||
<td><%= time @user.created_at %></td>
|
||||
</tr>
|
||||
<% if mod? || @user.is?(current_user) %>
|
||||
<tr>
|
||||
@@ -82,7 +82,7 @@
|
||||
<td><b>Last seen</b></td>
|
||||
<td>
|
||||
<% if @user.last_seen %>
|
||||
<time title="<%= @user.last_seen.strftime("%e %b %Y, %H:%M") %>" datetime="<%= @user.last_seen.to_datetime.rfc3339 %>"><%= @user.last_seen.strftime("%e %b %Y, %H:%M") %></time>
|
||||
<%= time @user.last_seen %>
|
||||
<% else %>
|
||||
Never
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user