diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3e9c203..0390858 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -10,7 +10,7 @@ module ApplicationHelper site_headers end - def time(tm) + def ago(tm) if tm content_tag :time, title: tm.strftime("%e %b %Y, %H:%M %Z"), datetime: tm.to_datetime.rfc3339 do tm.strftime("%e %b %Y, %H:%M") diff --git a/app/views/blogposts/index.html.erb b/app/views/blogposts/index.html.erb index c150727..9dadf42 100644 --- a/app/views/blogposts/index.html.erb +++ b/app/views/blogposts/index.html.erb @@ -9,7 +9,7 @@ <%= 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 p.created_at %> + <%= ago 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 17c8976..71a4b07 100644 --- a/app/views/blogposts/show.html.erb +++ b/app/views/blogposts/show.html.erb @@ -8,7 +8,7 @@ <%= 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 @post.created_at %> + <%= ago @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 d3096e7..7fbb915 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -3,7 +3,7 @@ <%= 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 c.created_at %> + <%= ago 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 9c642f1..0a24f6c 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -20,11 +20,11 @@ <% 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 last_reply.created_at %>. + <%= ago last_reply.created_at %>. <% else %> <%= last_thread.author.name %> <%= link_to "posted", forumthread_path(last_thread) %> - <%= time last_thread.created_at %>. + <%= ago 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 c564071..d844fe7 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -13,7 +13,7 @@ <%= 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 thread.created_at %> + <%= ago thread.created_at %> <% end %> <%= link_to pluralize(thread.replies.count, "Reply"), thread %> @@ -27,7 +27,7 @@ <% if rpl = thread.replies.last %> <%= rpl.author.name %> <%= link_to "replied", forumthread_path(thread) + "#reply-#{rpl.id}" %> - <%= time rpl.created_at %>. + <%= ago 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 c2e222a..16fa7dc 100644 --- a/app/views/forumthreads/show.html.erb +++ b/app/views/forumthreads/show.html.erb @@ -6,7 +6,7 @@ <%= 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 @thread.created_at %> + <%= ago @thread.created_at %> <% end %> <%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if (@thread.author.is?(current_user) || mod?) %>
@@ -14,7 +14,7 @@
<% if @thread.edited? %>
- Last edited <%= time @thread.updated_at %> by <%= link_to @thread.editor.name, @thread.editor %>. + Last edited <%= ago @thread.updated_at %> by <%= link_to @thread.editor.name, @thread.editor %>.
<% end %>
diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 34c0534..50f8dd8 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -10,7 +10,7 @@ <%= link_to blogposts_path, class: ("active" if con == "blogposts" || con == "comments") do %> News <% if last_post = Blogpost.last %> -
<%= time last_post.created_at %>
+
<%= ago last_post.created_at %>
<% end %> <% end %> diff --git a/app/views/threadreplies/_reply.html.erb b/app/views/threadreplies/_reply.html.erb index 39269b2..88e4bfb 100644 --- a/app/views/threadreplies/_reply.html.erb +++ b/app/views/threadreplies/_reply.html.erb @@ -3,7 +3,7 @@ <%= 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 reply.created_at %> + <%= ago 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 0c43b18..c426c33 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 %> + <%= ago @user.created_at %> <% if mod? || @user.is?(current_user) %> @@ -82,7 +82,7 @@ Last seen <% if @user.last_seen %> - <%= time @user.last_seen %> + <%= ago @user.last_seen %> <% else %> Never <% end %>