Commit a97e30b8d80c21c538319c192cd6fa52c418ee02
1 parent
aab6e871
Exists in
master
and in
29 other branches
Changing time_ago_as_sentence
When the item has more than 7 days it shows the date instead of "time ago"
Showing
6 changed files
with
12 additions
and
15 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -1217,15 +1217,12 @@ module ApplicationHelper |
1217 | 1217 | else _('1 minute') |
1218 | 1218 | end |
1219 | 1219 | |
1220 | - when 2..44 then _('%{distance} minutes') % { :distance => distance_in_minutes } | |
1221 | - when 45..89 then _('about 1 hour') | |
1222 | - when 90..1439 then _('about %{distance} hours') % { :distance => (distance_in_minutes.to_f / 60.0).round } | |
1223 | - when 1440..2879 then _('1 day') | |
1224 | - when 2880..43199 then _('%{distance} days') % { :distance => (distance_in_minutes / 1440).round } | |
1225 | - when 43200..86399 then _('about 1 month') | |
1226 | - when 86400..525599 then _('%{distance} months') % { :distance => (distance_in_minutes / 43200).round } | |
1227 | - when 525600..1051199 then _('about 1 year') | |
1228 | - else _('over %{distance} years') % { :distance => (distance_in_minutes / 525600).round } | |
1220 | + when 2..44 then _('%{distance} minutes ago') % { :distance => distance_in_minutes } | |
1221 | + when 45..89 then _('about 1 hour ago') | |
1222 | + when 90..1439 then _('about %{distance} hours ago') % { :distance => (distance_in_minutes.to_f / 60.0).round } | |
1223 | + when 1440..2879 then _('1 day ago') | |
1224 | + when 2880..10079 then _('%{distance} days ago') % { :distance => (distance_in_minutes / 1440).round } | |
1225 | + else show_time(from_time) | |
1229 | 1226 | end |
1230 | 1227 | end |
1231 | 1228 | ... | ... |
app/helpers/forum_helper.rb
... | ... | @@ -42,9 +42,9 @@ module ForumHelper |
42 | 42 | def last_topic_update(article) |
43 | 43 | info = article.info_from_last_update |
44 | 44 | if info[:author_url] |
45 | - time_ago_as_sentence(info[:date]) + ' ' + _('ago') + ' ' + _('by') + ' ' + link_to(info[:author_name], info[:author_url]) | |
45 | + time_ago_as_sentence(info[:date]) + ' ' + _('by') + ' ' + link_to(info[:author_name], info[:author_url]) | |
46 | 46 | else |
47 | - time_ago_as_sentence(info[:date]) + ' ' + _('ago') + ' ' + _('by') + ' ' + info[:author_name] | |
47 | + time_ago_as_sentence(info[:date]) + ' ' + _('by') + ' ' + info[:author_name] | |
48 | 48 | end |
49 | 49 | end |
50 | 50 | ... | ... |
app/views/profile/_create_article.rhtml
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | <span title='<%= activity.target.class.short_description %>' class='profile-activity-icon icon-new icon-new<%= activity.target.class.icon_name %>'></span><br /> |
9 | 9 | <%= image_tag(activity.params['first_image']) unless activity.params['first_image'].blank? %><%= strip_tags(activity.params['lead']).gsub(/(\xA0|\xC2|\s)+/, ' ').gsub(/^\s+/, '') %> <small><%= link_to(_('See more'), activity.params['url']) unless activity.get_lead.blank? %></small></div> |
10 | 10 | <%= content_tag(:p, link_to(_('See complete forum'), activity.get_url), :class => 'see-forum') if activity.target.is_a?(Forum) %> |
11 | - <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) + ' ' + _('ago') %></p> | |
11 | + <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) %></p> | |
12 | 12 | <div class='profile-wall-actions'> |
13 | 13 | <%= link_to _('Comment'), "#reply_content_#{activity.id}" %> |
14 | 14 | <%= link_to_remote(content_tag(:span, _('Remove')), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :confirm => _('Are you sure?'), :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %> | ... | ... |
app/views/profile/_default_activity.rhtml
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | </div> |
4 | 4 | <div class='profile-activity-description'> |
5 | 5 | <p class='profile-activity-text'><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></p> |
6 | - <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) + ' ' + _('ago') %></p> | |
6 | + <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) %></p> | |
7 | 7 | <div class='profile-wall-actions'> |
8 | 8 | <%= link_to _('Comment'), "#reply_content_#{activity.id}" %> |
9 | 9 | <%= link_to_remote(content_tag(:span, _('Remove')), :confirm => _('Are you sure?'), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %> | ... | ... |
app/views/profile/_profile_scrap.rhtml
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | <% comment_balloon :class => 'profile-activity-description' do %> |
6 | 6 | <p class='profile-activity-sender'><%= link_to scrap.sender.name, scrap.sender.url %></p> |
7 | 7 | <p class='profile-activity-text'><%= txt2html scrap.content %></p> |
8 | - <p class='profile-activity-time'><%= time_ago_as_sentence(scrap.created_at) + ' ' + _('ago') %></p> | |
8 | + <p class='profile-activity-time'><%= time_ago_as_sentence(scrap.created_at) %></p> | |
9 | 9 | <div class='profile-wall-actions'> |
10 | 10 | <% if logged_in? && current_person.follows?(scrap.sender) %> |
11 | 11 | <span class='profile-activity-send-reply'><%= link_to_function _('Comment'), "hide_and_show(['#profile-activity-reply-response-#{scrap.id}'],['#profile-activity-reply-#{scrap.id}', '#profile-activity-reply-form-#{scrap.id}']);$('reply_content_#{scrap.id}').value='';$('reply_content_#{scrap.id}').focus();$('scrap_id_#{scrap.id}').value='#{scrap.id}';return false", :class => "profile-send-reply" %></span> | ... | ... |
app/views/tasks/_abuse_complaint_accept_details.rhtml
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <% task.abuse_reports.each do |abuse_report| %> |
3 | 3 | <div> |
4 | 4 | <strong style="word-wrap: break-word; display: block; padding-right: 40px">"<%= abuse_report.reason %>"</strong> <br /> |
5 | - <i><%= _('Reported by %{reporter} %{time}.') % {:reporter => abuse_report.reporter.name, :time => time_ago_as_sentence(abuse_report.created_at) + ' ' + _('ago')}%></i> <br /> | |
5 | + <i><%= _('Reported by %{reporter} %{time}.') % {:reporter => abuse_report.reporter.name, :time => time_ago_as_sentence(abuse_report.created_at) }%></i> <br /> | |
6 | 6 | <% if !abuse_report.content.blank? %> |
7 | 7 | <button class="display-abuse-report-details" data-report="<%=abuse_report.id%>"><%=_('View details')%></button> |
8 | 8 | <div style='display: none' id=<%= 'abuse-report-details-'+abuse_report.id.to_s %> class="abuse-report-details"> | ... | ... |