/bans: replace Expires column with Duration.

This commit is contained in:
evazion
2017-04-12 22:48:09 -05:00
parent 1bc4eda12b
commit 198b6db507
2 changed files with 10 additions and 2 deletions

View File

@@ -81,6 +81,14 @@ module ApplicationHelper
content_tag(:time, content || datetime, :datetime => datetime, :title => time.to_formatted_s)
end
def humanized_duration(from, to)
duration = distance_of_time_in_words(from, to)
datetime = from.iso8601 + "/" + to.iso8601
title = "#{from.strftime("%Y-%m-%d %H:%M")} to #{to.strftime("%Y-%m-%d %H:%M")}"
raw content_tag(:time, duration, datetime: datetime, title: title)
end
def time_ago_in_words_tagged(time)
raw time_tag(time_ago_in_words(time) + " ago", time)
end

View File

@@ -8,7 +8,7 @@
<th>User</th>
<th>Banner</th>
<th>Banned</th>
<th>Expires</th>
<th>Duration</th>
<th>Reason</th>
<th></th>
</tr>
@@ -19,7 +19,7 @@
<td><%= link_to_user(ban.user) %></td>
<td><%= link_to_user(ban.banner) %></td>
<td><%= time_ago_in_words_tagged(ban.created_at) %></td>
<td><%= ban.expires_at %></td>
<td><%= humanized_duration(ban.created_at, ban.expires_at) %></td>
<td class="col-expand"><%= format_text ban.reason, :ragel => true %></td>
<td>
<% if CurrentUser.is_moderator? %>