relative timestamps

This commit is contained in:
jomo
2014-05-02 05:12:16 +02:00
parent 04066ba49f
commit a2ac6582b1
14 changed files with 70 additions and 23 deletions

View File

@@ -5,7 +5,7 @@
<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 } %> <time><%= link_to p.created_at.strftime("%e. %b %Y, %H:%M"), p %></time>
<%= render partial: "users/username", locals: { user: p.author } %> <%= link_to p do %><time datetime="<%= p.created_at.to_datetime.rfc3339 %>"><%= p.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
<span class="comment-counter">
<%= link_to pluralize(p.comments.count, "Comment"), p %>
</span>

View File

@@ -2,7 +2,7 @@
<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 } %> <time><%= link_to @post.created_at.strftime("%e. %b %Y, %H:%M"), p %></time>
<%= render partial: "users/username", locals: { user: @post.author } %> <%= link_to p do %><time datetime="<%= @post.created_at.to_datetime.rfc3339 %>"><%= @post.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
<%= link_to "edit", edit_blogpost_path(@post.id), class: "editlink" if mod? %>
<div class="clear-right"></div>
</div>

View File

@@ -2,7 +2,7 @@
<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 } %>
<time><%= link_to c.created_at.strftime("%e. %b %Y, %H:%M"), "#comment-#{c.id}" %></time>
<%= link_to "#comment-#{c.id}" do %><time datetime="<%= c.created_at.to_datetime.rfc3339 %>"><%= c.created_at.strftime("%e %b %Y, %H:%M") %></time><% 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>

View File

@@ -22,5 +22,5 @@
</table>
<p><%= f.submit "Update forum", class: "btn blue left" %></p>
<% end %>
<%# TODO delete %>
<p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right" %></p>
<div class="clear"></div>

View File

@@ -9,7 +9,7 @@
<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 } %> <time><%= link_to thread.created_at.strftime("%e. %b %Y, %H:%M"), thread %></time>
<%= render partial: "users/username", locals: { user: thread.author } %> <%= link_to thread do %><time datetime="<%= thread.created_at.to_datetime.rfc3339 %>"><%= thread.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
<span class="comment-counter">
<%= link_to pluralize(thread.replies.count, "Reply"), thread %>
</span>

View File

@@ -2,14 +2,14 @@
<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 } %> <time><%= link_to @thread.created_at.strftime("%e. %b %Y, %H:%M"), p %></time>
<%= render partial: "users/username", locals: { user: @thread.author } %> <%= link_to p do %><time datetime="<%= @thread.created_at.to_datetime.rfc3339 %>"><%= @thread.created_at.strftime("%e %b %Y, %H:%M") %></time><% 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><%= @thread.updated_at.strftime("%e. %b %Y, %H:%M") %></time> by <%= link_to @thread.editor.name, @thread.editor %>.
Last edited <time 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 %>.
</div>
<% end %>
<div class="item content">

View File

@@ -14,7 +14,7 @@
</tr>
<tr>
<td style="border:1px solid black;">Time</td>
<td style="border:1px solid black;"><%= @user.created_at.strftime("%e. %b %Y, %H:%M") %></td>
<td style="border:1px solid black;"><%= @user.created_at.strftime("%e %b %Y, %H:%M") %></td>
</tr>
<tr>
<td style="border:1px solid black;">Role</td>

View File

@@ -2,7 +2,7 @@
<div class="header">
<%= link_to(reply.author.avatar(64), reply.author, title: reply.author.ign) %>
<%= render partial: "users/username", locals: { user: reply.author } %>
<time><%= link_to reply.created_at.strftime("%e. %b %Y, %H:%M"), "#reply-#{reply.id}" %></time>
<%= link_to "#reply-#{reply.id}" do %><time datetime="<%= reply.created_at.to_datetime.rfc3339 %>"><%= reply.created_at.strftime("%e %b %Y, %H:%M") %></time><% end %>
<%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || reply.thread.author.is?(current_user) %>
<div class="clear-right"></div>

View File

@@ -64,7 +64,7 @@
<% end %>
<tr>
<td>Joined</td>
<td><%= @user.created_at.strftime("%e. %b %Y, %H:%M") %></td>
<td><%= @user.created_at.strftime("%e %b %Y, %H:%M") %></td>
</tr>
<% if mod? || @user.is?(current_user) %>
<tr>
@@ -77,7 +77,7 @@
</tr>
<tr>
<td>Last seen</td>
<td><%= @user.last_seen.strftime("%e. %b %Y, %H:%M") %></td>
<td><%= @user.last_seen.strftime("%e %b %Y, %H:%M") %></td>
</tr>
<% end %>
</tbody>