]> git.openstreetmap.org Git - rails.git/blob - app/helpers/changeset_helper.rb
Hide export button when export area is too large, closes #30
[rails.git] / app / helpers / changeset_helper.rb
1 module ChangesetHelper
2   def changeset_time_ago(changeset)
3     out = ''
4     created_at = distance_of_time_in_words_to_now(changeset.created_at)
5     closed_at = distance_of_time_in_words_to_now(changeset.closed_at)
6     if created_at == closed_at
7       out << t('browse.changeset_details.closed_at') + ' '
8       both_times = t('browse.changeset_details.created_at') + ': ' + l(changeset.created_at)
9       both_times << '&#10;'
10       both_times << t('browse.changeset_details.closed_at') + ': ' + l(changeset.closed_at)
11       out << content_tag(:abbr, t('browse.changeset_details.ago', :ago => created_at), title: both_times.html_safe)
12     else
13       out << t('browse.changeset_details.created_at') + ' '
14       out << content_tag(:abbr, t('browse.changeset_details.ago', :ago => created_at), title: l(changeset.created_at))
15       out << t('browse.changeset_details.closed_at') + ' '
16       out << content_tag(:abbr, t('browse.changeset_details.ago', :ago => closed_at), title: l(changeset.closed_at))
17     end
18     if changeset.user.data_public?
19       out << ' ' + t('browse.changeset_details.by') + ' '
20       out << link_to(h(changeset.user.display_name), :controller => "user", :action => "view", :display_name => changeset.user.display_name)
21     end
22     return out.html_safe
23   end
24 end