]> git.openstreetmap.org Git - rails.git/blob - app/helpers/changeset_helper.rb
Avoid using Rails.application.assets as it no longer set in production
[rails.git] / app / helpers / changeset_helper.rb
1 module ChangesetHelper
2   def changeset_user_link(changeset)
3     if changeset.user.data_public?
4       link_to(changeset.user.display_name, user_path(changeset.user.display_name))
5     else
6       t("browse.anonymous")
7     end
8   end
9
10   def changeset_details(changeset)
11     if changeset.closed_at > DateTime.now
12       action = :created
13       time = distance_of_time_in_words_to_now(changeset.created_at)
14       title = l(changeset.created_at)
15     else
16       action = :closed
17       time = distance_of_time_in_words_to_now(changeset.closed_at)
18       title = "#{t('browse.created')}: #{l(changeset.created_at)}
#{t('browse.closed')}: #{l(changeset.closed_at)}".html_safe
19     end
20
21     if params.key?(:display_name)
22       t "browse.#{action}_html",
23         :time => time,
24         :title => title
25     else
26       t "browse.#{action}_by_html",
27         :time => time,
28         :title => title,
29         :user => changeset_user_link(changeset)
30     end
31   end
32 end