diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 82a4a6768..a55269410 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,6 +5,11 @@ module ApplicationHelper @@youtube_title_cache = Hash.new("no-title") + def timeago(time, options = {}) + options[:class] ||= "timeago" + content_tag(:abbr, time.to_s, options.merge(:title => time.getutc.iso8601)) if time + end + def modern_browser? false end @@ -95,14 +100,15 @@ module ApplicationHelper def mine?(post) current_user.owns? post end - + def type_partial(post) class_name = post.class.name.to_s.underscore "#{class_name.pluralize}/#{class_name}" end def how_long_ago(obj) - I18n.t('ago', :time => time_ago_in_words(obj.created_at, true)) + timeago(obj.created_at) + #I18n.t('ago', :time => time_ago_in_words(obj.created_at, true)) end def person_url(person) diff --git a/lib/tasks/statistics.rake b/lib/tasks/statistics.rake index 436d5ff5f..e03e2832e 100644 --- a/lib/tasks/statistics.rake +++ b/lib/tasks/statistics.rake @@ -17,10 +17,8 @@ namespace :statistics do "last_7d=#{User.where(:current_sign_in_at.gt => Time.now - 7.days).count}, " + "notification_off=#{User.where(:disable_mail=>true).count}, "+ "notification_off_%=#{User.where(:disable_mail=>true).count.to_f/User.count}, "+ - "no_invites=#{User.where(:invites => 0).count} " - - - puts "event=statistic, type=users, last_7d_%=#{User.where(:current_sign_in_at.gt => Time.now - 7.days).count.to_f/User.count}, " + + "no_invites=#{User.where(:invites => 0).count}, "+ + "last_7d_%=#{User.where(:current_sign_in_at.gt => Time.now - 7.days).count.to_f/User.count}, " + "last_7d_and_notifications_off_%=#{User.where(:current_sign_in_at.gt => Time.now - 7.days, :disable_mail => true).count.to_f/User.where(:disable_mail=>true).count}, " + "last_7d_and_no_invites_%=#{User.where(:current_sign_in_at.gt => Time.now - 7.days, :invites => 0).count.to_f/User.where(:invites => 0).count}"