]> git.openstreetmap.org Git - rails.git/blob - app/helpers/note_helper.rb
Use time instead of abbr element for changesets_helper
[rails.git] / app / helpers / note_helper.rb
1 module NoteHelper
2   include ActionView::Helpers::TranslationHelper
3
4   def note_event(event, at, by)
5     if by.nil?
6       t("notes.show.event_#{event}_by_anonymous_html",
7         :time_ago => friendly_date_ago(at))
8     else
9       t("notes.show.event_#{event}_by_html",
10         :time_ago => friendly_date_ago(at),
11         :user => note_author(by))
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
25   def disappear_in(note)
26     date = note.freshly_closed_until
27     tag.span(distance_of_time_in_words(date, Time.now.utc), :title => l(date, :format => :friendly))
28   end
29 end