Permalink
Browse files

Shows full date and time when hovering date/time in exception index. …

…Refactored strftime into defined formats and to_s.
  • Loading branch information...
1 parent d0c3f46 commit ba110c83b175f597e3bc1425c9c583d14ee0002c @henrik henrik committed Aug 18, 2008
Showing with 14 additions and 6 deletions.
  1. +7 −1 lib/exception_loggable.rb
  2. +6 −4 views/logged_exceptions/_exceptions.rhtml
  3. +1 −1 views/logged_exceptions/_show.rhtml
@@ -23,8 +23,14 @@
module ExceptionLoggable
def self.included(target)
target.extend(ClassMethods)
- end
+ ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!({
+ :exc_full => "%A, %b %d, %Y at %l:%M %p",
+ :exc_date => "%b %d, %Y",
+ :exc_time => "%l:%M %p"
+ })
+ end
+
module ClassMethods
def consider_local(*args)
local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) })
@@ -29,20 +29,22 @@
<span class="message"><%=h exc.message %></span>
</td>
- <td nowrap=nowrap class="time">
+<td nowrap=nowrap class="time">
+ <abbr title="<%= exc.created_at.to_s(:exc_full) %>">
<%
if Date.today == exc.created_at.to_date
if exc.created_at > Time.now - 4.hours
%>
<%= time_ago_in_words(exc.created_at).gsub(/about /,"~ ") %> ago
<% else %>
- Today, <%= exc.created_at.strftime("%l:%M %p") %>
+ Today, <%= exc.created_at.to_s(:exc_time) %>
<% end %>
<% else %>
-<%= exc.created_at.strftime("%b %d, %Y") %>
+<%= exc.created_at.to_s(:exc_date) %>
<% end %>
+ </abbr>
</td>
- <td><%= link_to_remote 'Delete', {:url => { :action => 'destroy', :id => exc }} , :class => "util" %></td>
+<td><%= link_to_remote 'Delete', {:url => { :action => 'destroy', :id => exc }} , :class => "util" %></td>
</tr>
<% end -%>
@@ -6,7 +6,7 @@
</div>
<div class="date">
- <%= @exc.created_at.strftime("%A, %b %d, %Y at %l:%M %p") %>
+ <%= @exc.created_at.to_s(:exc_full) %>
</div>
<h1>
<%= @exc.exception_class %> in <%= @exc.controller_name.camelcase %>/<%= @exc.action_name %>

0 comments on commit ba110c8

Please sign in to comment.