]> git.openstreetmap.org Git - rails.git/blob - app/helpers/note_helper.rb
89c8cc376a24b7eadaa2b042be51e845306a9b62
[rails.git] / app / helpers / note_helper.rb
1 module NoteHelper
2   def note_event(event, at, by)
3     if by.nil?
4       I18n.t("browse.note." + event + "_by_anonymous",
5              :when => friendly_date(at),
6              :exact_time => l(at)).html_safe
7     else
8       I18n.t("browse.note." + event + "_by",
9              :when => friendly_date(at),
10              :exact_time => l(at),
11              :user => note_author(by)).html_safe
12     end
13   end
14
15   def note_author(author, link_options = {})
16     if author.nil?
17       ""
18     elsif author.status == "deleted"
19       t("users.no_such_user.deleted")
20     else
21       link_to h(author.display_name), link_options.merge(:controller => "users", :action => "show", :display_name => author.display_name)
22     end
23   end
24 end