diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c31efdf..2a181fd 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1215,35 +1215,6 @@ module ApplicationHelper
list.sort.inject(Hash.new(0)){|h,i| h[i] += 1; h }.collect{ |x, n| [n, connector, x].join(" ") }.sort
end
- #FIXME Use time_ago_in_words instead of this method if you're using Rails 2.2+
- def time_ago_as_sentence(from_time, include_seconds = false)
- to_time = Time.now
- from_time = Time.parse(from_time.to_s)
- from_time = from_time.to_time if from_time.respond_to?(:to_time)
- to_time = to_time.to_time if to_time.respond_to?(:to_time)
- distance_in_minutes = (((to_time - from_time).abs)/60).round
- distance_in_seconds = ((to_time - from_time).abs).round
- case distance_in_minutes
- when 0..1
- return (distance_in_minutes == 0) ? _('less than a minute') : _('1 minute') unless include_seconds
- case distance_in_seconds
- when 0..4 then _('less than 5 seconds')
- when 5..9 then _('less than 10 seconds')
- when 10..19 then _('less than 20 seconds')
- when 20..39 then _('half a minute')
- when 40..59 then _('less than a minute')
- else _('1 minute')
- end
-
- when 2..44 then _('%{distance} minutes ago') % { :distance => distance_in_minutes }
- when 45..89 then _('about 1 hour ago')
- when 90..1439 then _('about %{distance} hours ago') % { :distance => (distance_in_minutes.to_f / 60.0).round }
- when 1440..2879 then _('1 day ago')
- when 2880..10079 then _('%{distance} days ago') % { :distance => (distance_in_minutes / 1440).round }
- else show_time(from_time)
- end
- end
-
def comment_balloon(options = {}, &block)
wrapper = content_tag(:div, capture(&block), :class => 'comment-balloon-content')
(1..8).to_a.reverse.each { |i| wrapper = content_tag(:div, wrapper, :class => "comment-wrapper-#{i}") }
diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb
index aa08107..a185502 100644
--- a/app/helpers/blog_helper.rb
+++ b/app/helpers/blog_helper.rb
@@ -2,7 +2,6 @@ module BlogHelper
include ArticleHelper
-
def custom_options_for_article(article,tokenized_children)
@article = article
hidden_field_tag('article[published]', 1) +
diff --git a/app/helpers/comment_helper.rb b/app/helpers/comment_helper.rb
index 9b93e8c..c8e780a 100644
--- a/app/helpers/comment_helper.rb
+++ b/app/helpers/comment_helper.rb
@@ -1,4 +1,5 @@
module CommentHelper
+ include DatesHelper
def article_title(article, args = {})
title = article.title
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index 3b66568..c71ef3f 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -1,5 +1,6 @@
module EventsHelper
+ include DatesHelper
def list_events(date, events)
title = _('Events for %s') % show_date_month(date)
content_tag('h2', title) +
diff --git a/app/helpers/forum_helper.rb b/app/helpers/forum_helper.rb
index 7d8bd24..a82d2dc 100644
--- a/app/helpers/forum_helper.rb
+++ b/app/helpers/forum_helper.rb
@@ -1,4 +1,5 @@
module ForumHelper
+ include ActionView::Helpers::DateHelper
def cms_label_for_new_children
_('New discussion topic')
@@ -42,9 +43,9 @@ module ForumHelper
def last_topic_update(article)
info = article.info_from_last_update
if info[:author_url]
- time_ago_as_sentence(info[:date]) + ' ' + _('by') + ' ' + link_to(info[:author_name], info[:author_url])
+ time_ago_in_words(info[:date]) + ' ' + _('by') + ' ' + link_to(info[:author_name], info[:author_url])
else
- time_ago_as_sentence(info[:date]) + ' ' + _('by') + ' ' + info[:author_name]
+ time_ago_in_words(info[:date]) + ' ' + _('by') + ' ' + info[:author_name]
end
end
diff --git a/app/views/person_notifier/mailer/_comment.html.erb b/app/views/person_notifier/mailer/_comment.html.erb
index 89f3512..435006b 100644
--- a/app/views/person_notifier/mailer/_comment.html.erb
+++ b/app/views/person_notifier/mailer/_comment.html.erb
@@ -19,7 +19,7 @@
<%= comment.title %>
<% end %>
<%= txt2html comment.body %>
- <%= time_ago_as_sentence(comment.created_at) %>
+ <%= time_ago_in_words(comment.created_at) %>
<% unless comment.replies.blank? %>
diff --git a/app/views/person_notifier/mailer/_create_article.html.erb b/app/views/person_notifier/mailer/_create_article.html.erb
index 1cf53e9..d514e4b 100644
--- a/app/views/person_notifier/mailer/_create_article.html.erb
+++ b/app/views/person_notifier/mailer/_create_article.html.erb
@@ -6,7 +6,7 @@
<%= link_to activity.user.short_name(20), activity.user.url %> <%= _("has published on community %s") % link_to(activity.target.profile.short_name(20), activity.target.profile.url, :style => "color: #333; font-weight: bold; text-decoration: none;") if activity.target.profile.is_a?(Community) %> - <%= time_ago_as_sentence(activity.created_at) %> + <%= time_ago_in_words(activity.created_at) %>
<%= link_to(activity.params['name'], activity.params['url'], :style => "color: #333; font-weight: bold; text-decoration: none;") %> diff --git a/app/views/person_notifier/mailer/_default_activity.html.erb b/app/views/person_notifier/mailer/_default_activity.html.erb index 135e10b..c1bd5c1 100644 --- a/app/views/person_notifier/mailer/_default_activity.html.erb +++ b/app/views/person_notifier/mailer/_default_activity.html.erb @@ -5,7 +5,7 @@
<%= link_to activity.user.name, activity.user.url %> <%= describe activity %> - <%= time_ago_as_sentence(activity.created_at) %> + <%= time_ago_in_words(activity.created_at) %>
<%= link_to activity.user.name, activity.user.url %> <%= describe activity %> - <%= time_ago_as_sentence(activity.created_at) %> + <%= time_ago_in_words(activity.created_at) %>
<%= time_ago_as_sentence(activity.created_at) %>
+<%= time_ago_in_words(activity.created_at) %>
<%= link_to activity.user.name, activity.user.url %> <%= describe activity %>
-<%= time_ago_as_sentence(activity.created_at) %>
+<%= time_ago_in_words(activity.created_at) %>
<%= link_to activity.user.name, activity.user.url %> <%= describe activity %>
-<%= time_ago_as_sentence(activity.created_at) %>
+<%= time_ago_in_words(activity.created_at) %>
<%= link_to scrap.sender.name, scrap.sender.url %>
<%= txt2html scrap.content %>
-<%= time_ago_as_sentence(scrap.created_at) %>
+<%= time_ago_in_words(scrap.created_at) %>
<%= link_to scrap.sender.name, scrap.sender.url %>
<%= txt2html scrap.content %>
-<%= time_ago_as_sentence(scrap.created_at) %>
+<%= time_ago_in_words(scrap.created_at) %>
<%= link_to activity.user.name, activity.user.url %> <%= describe activity %>
-<%= time_ago_as_sentence(activity.created_at) %>
+<%= time_ago_in_words(activity.created_at) %>