diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f60cc6b..c8d97ae 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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, diff --git a/app/views/blogposts/index.html.erb b/app/views/blogposts/index.html.erb index a746ab2..c150727 100644 --- a/app/views/blogposts/index.html.erb +++ b/app/views/blogposts/index.html.erb @@ -7,7 +7,10 @@
<%= link_to(p.author.avatar(64), p.author, title: p.author.ign) %> - <%= render partial: "users/username", locals: { user: p.author } %> <%= link_to p do %><% end %> + <%= render partial: "users/username", locals: { user: p.author } %> + <%= link_to p do %> + <%= time p.created_at %> + <% end %> <%= link_to pluralize(p.comments.count, "Comment"), p %> diff --git a/app/views/blogposts/show.html.erb b/app/views/blogposts/show.html.erb index 2bd4cf8..17c8976 100644 --- a/app/views/blogposts/show.html.erb +++ b/app/views/blogposts/show.html.erb @@ -6,7 +6,10 @@
<%= link_to(@post.author.avatar(64), @post.author, title: @post.author.ign) %> - <%= render partial: "users/username", locals: { user: @post.author } %> <%= link_to p do %><% 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? %>
diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index a20df7d..d3096e7 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -2,7 +2,9 @@
"> <%= 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 %><% 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)) %>
diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 683a3ab..9c642f1 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -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}" %> . + <%= 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) %> . + <%= last_thread.author.name %> + <%= link_to "posted", forumthread_path(last_thread) %> + <%= time last_thread.created_at %>. <% end %> <% else %> No posts yet. diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 6602f31..c564071 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -11,7 +11,10 @@
<%= link_to(thread.author.avatar(64), thread.author, title: thread.author.ign) %> - <%= render partial: "users/username", locals: { user: thread.author } %> <%= link_to thread do %><% end %> + <%= render partial: "users/username", locals: { user: thread.author } %> + <%= link_to thread do %> + <%= time thread.created_at %> + <% end %> <%= link_to pluralize(thread.replies.count, "Reply"), thread %> @@ -22,7 +25,9 @@ <%= link_to truncate(thread.title, length: 60, omission: " …"), forumthread_path(thread), title: thread.title %>
<% if rpl = thread.replies.last %> - <%= rpl.author.name %> <%= link_to "replied", forumthread_path(thread) + "#reply-#{rpl.id}" %> . + <%= rpl.author.name %> + <%= link_to "replied", forumthread_path(thread) + "#reply-#{rpl.id}" %> + <%= time rpl.created_at %>. <% else %> No replies yet. <% end %> diff --git a/app/views/forumthreads/show.html.erb b/app/views/forumthreads/show.html.erb index b8520bf..0617341 100644 --- a/app/views/forumthreads/show.html.erb +++ b/app/views/forumthreads/show.html.erb @@ -4,14 +4,17 @@
<%= link_to(@thread.author.avatar(64), @thread.author, title: @thread.author.ign) %> - <%= render partial: "users/username", locals: { user: @thread.author } %> <%= link_to p do %><% 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?) %>
<% if @thread.edited? %>
- Last edited by <%= link_to @thread.editor.name, @thread.editor %>. + Last edited <%= time @thread.updated_at %> by <%= link_to @thread.editor.name, @thread.editor %>.
<% end %>
diff --git a/app/views/threadreplies/_reply.html.erb b/app/views/threadreplies/_reply.html.erb index 3618d91..39269b2 100644 --- a/app/views/threadreplies/_reply.html.erb +++ b/app/views/threadreplies/_reply.html.erb @@ -2,7 +2,9 @@
<%= 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 %><% 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) %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 67cd700..0c43b18 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -67,7 +67,7 @@ <% end %> Joined - + <%= time @user.created_at %> <% if mod? || @user.is?(current_user) %> @@ -82,7 +82,7 @@ Last seen <% if @user.last_seen %> - + <%= time @user.last_seen %> <% else %> Never <% end %>