implemented last-forum-read-at

This commit is contained in:
albert
2011-08-23 17:11:21 -04:00
parent e3a9614930
commit 124403a921
12 changed files with 51 additions and 16 deletions

View File

@@ -23,13 +23,20 @@ module ApplicationHelper
end
end
def time_tag(content = nil, time)
zone = time.strftime("%z")
datetime = time.strftime("%Y-%m-%dT%H:%M" + zone[0, 3] + ":" + zone[3, 2])
content_tag(:time, content || datetime, :datetime => datetime)
end
def compact_time(time)
if time > Time.now.beginning_of_day
time.strftime("%H:%M")
time_tag(time.strftime("%H:%M"), time)
elsif time > Time.now.beginning_of_year
time.strftime("%b %e")
time_tag(time.strftime("%b %e"), time)
else
time.strftime("%b %e, %Y")
time_tag(time.strftime("%b %e, %Y"), time)
end
end