Simplify date display by using friendly_date helpers

This commit is contained in:
Andy Allan 2023-11-15 19:46:10 +00:00
parent 0058765a4e
commit 0195dd60a4
4 changed files with 7 additions and 10 deletions

View file

@ -14,8 +14,7 @@
<ul class="list-unstyled">
<li>
<%= t "browse.#{common_details.visible? ? :edited : :deleted}_ago_by_html",
:time_ago => tag.abbr(time_ago_in_words(common_details.timestamp, :scope => :"datetime.distance_in_words_ago"),
:title => l(common_details.timestamp)),
:time_ago => friendly_date_ago(common_details.timestamp),
:user => changeset_user_link(common_details.changeset) %>
</li>
<li>

View file

@ -18,7 +18,9 @@
<% @comments.each do |comment| -%>
<tr>
<td width="25%" class="<%= "text-muted" unless comment.visible? %>"><%= link_to comment.diary_entry.title, diary_entry_path(comment.diary_entry.user, comment.diary_entry) %></td>
<td width="25%" class="<%= "text-muted" unless comment.visible? %>"><span title="<%= l comment.created_at, :format => :friendly %>"><%= time_ago_in_words(comment.created_at, :scope => :"datetime.distance_in_words_ago") %></span></td>
<td width="25%" class="<%= "text-muted" unless comment.visible? %>">
<%= friendly_date_ago(comment.created_at) %>
</td>
<td width="50%" class="richtext text-break<%= " text-muted" unless comment.visible? %>"><%= comment.body.to_html %></td>
</tr>
<% end -%>

View file

@ -61,13 +61,11 @@
<td><%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %></td>
<td><%= link_to issue.reported_user.display_name, user_path(issue.reported_user) if issue.reported_user %></td>
<td>
<% time_ago_tag = tag.abbr(time_ago_in_words(issue.updated_at, :scope => :"datetime.distance_in_words_ago"),
:title => l(issue.updated_at)) %>
<% if issue.user_updated %>
<%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)),
:time_ago => time_ago_tag %>
:time_ago => friendly_date_ago(issue.updated_at) %>
<% else %>
<%= time_ago_tag %>
<%= friendly_date_ago(issue.updated_at) %>
<% end %>
</td>
</tr>

View file

@ -29,9 +29,7 @@
</li>
</ul>
<p class="text-muted mb-0">
<span title="<%= trace.timestamp %>">
<%= time_ago_in_words(trace.timestamp, :scope => :"datetime.distance_in_words_ago") %>
</span>
<%= friendly_date_ago(trace.timestamp) %>
<%= t ".by" %> <%= link_to trace.user.display_name, user_path(trace.user) %>
<% if !trace.tags.empty? %>
<%= t ".in" %>